SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Thread Tools Display Modes
Old 02/07/2013, 04:12 PM   #1
Huge Clucker
McBan's Avatar
Join Date: Apr 2012
Posts: 237
Reputation: 20
Default [BEGINNER] Simple Commands & Functions

Simple Commands & Functions

Client & Server

Before you decide you want to script for your server, Make sure you have the latest server files from here: and make sure your client is up to date too (Currently 0.3x is the latest).


So, Make sure to have opened your server folder and have opened a program called 'Pawno'. Pawno is a complex scripting program used by mainly SA-MP scripters for handling and editing their server. Some people are obviously on different levels of expertise than others on scripting, So therefore this is a starters guide for those who may need help.

Simple Command

So, Under:

    return 1;
Write a function, Telling the program to send a message to a specific player, So start off with the function, Like so:

The above function declares to the program to send a message, But you have not specified a player (Target), So lets do that now:

    SendClientMessage(playerid, 0xFFFFFF, "Replace me");
And voila!

Lets get that straight.

   SendClientMessage(playerid, 0xFFFFFF, "Replace me");

   [The Function][Open Bracket][Target][comma][The colour][comma][speech marks][Text][speech marks][Close      bracket][Semi Colon]
That is a simple SendClientMessage function. All it does is send a message to the player who types the command in, The full command is below:

if (strcmp("/mycommand", cmdtext, true, 10) == 0)
		SendClientMessage(playerid, 0xFFFFFF, "Replace me");
		return 1;

I hope that this will help those beginners to understand the meaning of "scripting" and now have a bit of knowledge about functions and declarations. More tutorials will be posted soon. Need help? PM me.

You are welcome to give me any feedback
McBan is offline   Reply With Quote
Old 02/07/2013, 05:27 PM   #2
Little Clucker
Join Date: Mar 2013
Location: Cork, Ireland
Posts: 23
Reputation: 0
Default Re: [BEGINNER] Simple Commands & Functions

You should really add some more commands.
I play on InterGaming Roleplay

I map things, Check out the InterGaming forums for more,
mahony0509 is offline   Reply With Quote
Old 02/07/2013, 05:36 PM   #3
Spam Machine
Vince's Avatar
Join Date: Sep 2007
Location: Belgium
Posts: 10,068
Reputation: 2658
Default Re: [BEGINNER] Simple Commands & Functions

Why are beginners supposed to start with the oldest and - in most cases - slowest methods? Either teach the current methods or don't make a topic at all. Sorry to be harsh, but it needs to be said.

I assume you are knowledgeable on this subject, so please tell me what the 10 symbolizes in this line:
pawn Code:
if (strcmp("/mycommand", cmdtext, true, 10) == 0)

@Beneath me: Thank you, but I was awaiting a response from the OP. If he doesn't (or didn't) know what it is for then he's not knowledgeable on the subject and therefore shouldn't have made a tutorial.
Vince is offline   Reply With Quote
Old 02/07/2013, 05:39 PM   #4
Join Date: Feb 2011
Location: Portugal
Posts: 1,474
Reputation: 289
Default Re: [BEGINNER] Simple Commands & Functions

I believe that '10' is the number of characters the command has (includes the slash). If the command was /kill, it'd be:

pawn Code:
if (strcmp("/kill", cmdtext, true, 5) == 0)

Not sure If I am correct though, I'm a beginner.
Twizted is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] [INC] LSF - Lorenc's Simple Functions (w/ gang/clan functions) Lorenc_ Includes 14 21/04/2018 04:06 AM
Beginner making commands Windrush Scripting Help 2 18/08/2012 07:18 AM
Simple beginner question sim_sima Help Archive 4 26/02/2011 03:06 PM
Simple beginner questions sim_sima Help Archive 4 13/01/2011 03:03 PM

All times are GMT. The time now is 07:17 PM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.