26.08.2012, 16:17
(
Last edited by Lordzy; 26/08/2012 at 05:05 PM.
)
How to create a simple Announce command
Introduction
This is a simple tutorial which helps you to learn how to create simple announce commands using Zcmd and Sscanf2
I apologise now itself if this tutorial isnt well explained/wrong because Im posting this using mobile.
Also this is my first tutorial.
ZCMD:It is a command processor which allows to create command in a simple way and execute it faster.
Download:forum.sa-mp.com/showthread.php?t=91354
Sscanf2:Here sscanf2 is used to input text to announce for all and also for easy scripting.
Download:forum.sa-mp.com/showthread.php?t=120356
Use
First lets include files which is needed to run the script.
Here we are going to use 3 includes.
a_samp[Needed for every script]
zcmd[For faster and simple command executing]
sscanf2[For inputing the text in an easy way.]
So,lets start with including files.
NOTE:a_samp is needed for every script,so you must start with a_samp include.
We've included the includes needed to run the script,now lets start making command.
Here's an example of command way in zcmd
Lets start creating our command under the includes.
Finalised Code
Credits
a_samp by SAMP Team.
Zcmd by ZeeX.
Sscanf by ******.
Tutorial by [xB]Lordz.(me )
NOTE:If there is any error,mistake or problem,please post here.
Introduction
This is a simple tutorial which helps you to learn how to create simple announce commands using Zcmd and Sscanf2
I apologise now itself if this tutorial isnt well explained/wrong because Im posting this using mobile.
Also this is my first tutorial.
ZCMD:It is a command processor which allows to create command in a simple way and execute it faster.
Download:forum.sa-mp.com/showthread.php?t=91354
Sscanf2:Here sscanf2 is used to input text to announce for all and also for easy scripting.
Download:forum.sa-mp.com/showthread.php?t=120356
Use
First lets include files which is needed to run the script.
Here we are going to use 3 includes.
a_samp[Needed for every script]
zcmd[For faster and simple command executing]
sscanf2[For inputing the text in an easy way.]
So,lets start with including files.
NOTE:a_samp is needed for every script,so you must start with a_samp include.
pawn Code:
#include <a_samp> //Included a_samp.
#include <zcmd> //Included zcmd.
#include <sscanf2> //Included sscanf2.
Here's an example of command way in zcmd
pawn Code:
CMD:zcmdway(playerid,params[])
{
//This is the command way of zcmd.
//Here function.
pawn Code:
CMD:announce(playerid,params[])
{
//Zcmd command processor system. ^
new text[60]; //Create a new variable to execute text via sscanf.[60]refers to its string length.
if(sscanf(params, "s[60]",text)) //Here we are using "s" to output entered text.[60] is the string.
//And we've executed "text" variable here.
//By doing these,we have created a function to detect usage.
return SendClientMessage(playerid, 0xFF0000, "Usage:/announce [text]");//Here we are adding a message how to use if player doesnt inputs text.
GameTextForAll(text,3000,3); //Here,we're using this to announce our text in GameText style.
//You can change the style of Gametext by changing the "3" at last.
//And the 3000 refers to time(milliseconds) of gametext to be displayed.
//GameTexts: wiki.sa-mp.com/wiki/GameTextForPlayer
return 1; //We're returning the cmd here.
} //Closing brackets to end cmd.
pawn Code:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
CMD:announce(playerid,params[])
{
new text[60];
if(sscanf(params,"s[60]",text))
return SendClientMessage(playerid, 0xFF0000, "Usage:/announce [text]");
GameTextForAll(text,3000,3);
return 1;
}
a_samp by SAMP Team.
Zcmd by ZeeX.
Sscanf by ******.
Tutorial by [xB]Lordz.(me )
NOTE:If there is any error,mistake or problem,please post here.