[Tutorial] How to create a simple announce cmd[sscanf|| Zcmd]
#1

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.
pawn Code:
#include <a_samp> //Included a_samp.
#include <zcmd> //Included zcmd.
#include <sscanf2> //Included sscanf2.
We've included the includes needed to run the script,now lets start making command.
Here's an example of command way in zcmd
pawn Code:
CMD:zcmdway(playerid,params[])
{
  //This is the command way of zcmd.
   //Here function.
Lets start creating our command under the includes.
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.
Finalised Code
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;
}
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.
Reply


Messages In This Thread
How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 26.08.2012, 16:17
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Kaperstone - 26.08.2012, 16:18
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by TaLhA XIV - 26.08.2012, 16:33
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Akira297 - 26.08.2012, 16:36
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 26.08.2012, 17:02
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by DeadLy™ - 26.08.2012, 17:05
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by iGetty - 26.08.2012, 17:16
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Kaperstone - 26.08.2012, 18:20
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 26.08.2012, 18:26
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 27.08.2012, 12:03
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by C00K13M0N$73R - 27.08.2012, 12:09
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 27.08.2012, 12:21
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 28.08.2012, 16:02
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Glint - 29.08.2012, 07:10
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 29.08.2012, 10:10
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Cjgogo - 29.08.2012, 13:57
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Smokkr - 29.08.2012, 14:04
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 29.08.2012, 15:08
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by irfu - 30.08.2012, 08:48
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 31.08.2012, 06:33
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Jeth - 31.08.2012, 07:48
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by Lordzy - 31.08.2012, 12:08
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by SRB - 25.10.2013, 23:41
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by DobbysGamertag - 26.10.2013, 00:11
Re: How to create a simple announce cmd[sscanf|| Zcmd] - by SRB - 26.10.2013, 00:46

Forum Jump:


Users browsing this thread: 6 Guest(s)