[Tutorial] [BEGINNER] Simple Commands & Functions
#1

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: www.sa-mp.com/download.php and make sure your client is up to date too (Currently 0.3x is the latest).

Pawno

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:

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

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

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

Lets get that straight.

Code:
   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:

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

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
Reply


Messages In This Thread
[BEGINNER] Simple Commands & Functions - by McBan - 02.07.2013, 16:12
Re: [BEGINNER] Simple Commands & Functions - by mahony0509 - 02.07.2013, 17:27
Re: [BEGINNER] Simple Commands & Functions - by Vince - 02.07.2013, 17:36
Re: [BEGINNER] Simple Commands & Functions - by Twizted - 02.07.2013, 17:39

Forum Jump:


Users browsing this thread: 1 Guest(s)