How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 26.08.2012
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.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Kaperstone - 26.08.2012
nice tutorial,well explaned.
command proccecor*
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
TaLhA XIV - 26.08.2012
Nice well explained.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Akira297 - 26.08.2012
I love it, it even makes it awesome that you posted on my wall asking me if the command would work.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 26.08.2012
Quote:
Originally Posted by Akira297
I love it, it even makes it awesome that you posted on my wall asking me if the command would work.
|
LOL,I aint having Pc and did it through mobile.
So i wasnt sure that this is correct or not.
Quote:
Originally Posted by TaLhA XIV
Nice well explained.
|
Thanks.
Quote:
Originally Posted by xkirill
nice tutorial,well explaned.
command proccecor*
|
Thanks and I'll chage it.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
DeadLy™ - 26.08.2012
Nice work! Lordz, you are really good man. nice explained +rep 1
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
iGetty - 26.08.2012
Quote:
Originally Posted by Akira297
I love it, it even makes it awesome that you posted on my wall asking me if the command would work.
|
I saw that, lawl.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Kaperstone - 26.08.2012
Quote:
Originally Posted by [xB]Lordz
Thanks and I'll chage it.
|
Quote:
//Zcmd command processor system. ^
|
remove the system.
and its ZCmd,
Z stands for Zeex and and cmd for command.
so its ZCmd or better zcmd (with no capital letters)
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 26.08.2012
Quote:
Originally Posted by xkirill
remove the system.
and its ZCmd,
Z stands for Zeex and and cmd for command.
so its ZCmd or better zcmd (with no capital letters)
|
No not this again...
It takes a lot of time to edit because of more texts used.
My E71 is lagging a lot while editing and got hanged.
Now switched off and switched on again.
I'll edit later...
Thx xkiril.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 27.08.2012
Can I get more comments?
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
C00K13M0N$73R - 27.08.2012
pawn Code:
CMD:announce(playerid,params[])
{
if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE:/announce [text]");
GameTextForAll(params,3000,3);
return 1;
}
You dont need sscanf for one parameter commands.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 27.08.2012
Quote:
Originally Posted by C00K13M0N$73R
pawn Code:
CMD:announce(playerid,params[]) { if(isnull(params)) return SendClientMessage(playerid,-1,"USAGE:/announce [text]"); GameTextForAll(params,3000,3); return 1; }
You dont need sscanf for one parameter commands.
|
For me,sscanf is more easier and better.
Btw you're right,here we dont need sscanf to do this,but while making a lot of commands(Eg:Adm cmds),sscanf will be more better.
Because while using sscanf,cmds which requires parameters can be easily created without any confusion or other problems etc
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 28.08.2012
Any more feedbacks?
Re: How to create a simple announce cmd[sscanf|| Zcmd] - Glint - 29.08.2012
Good job writing this on a mobile is kinda difficult, but also you can make this without using sscanf too, the command is /announce [text], so you could just use the params[], parameter in zcmd, other then that nicely explained.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 29.08.2012
Thank you Lexi'.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Cjgogo - 29.08.2012
Even if it's a simple tutorial,I like it because it uses cool features of SAMP coding,lik sscanf,zcmd,etc.If I saw a tutorial that uses strcmp,strtok,I'd probably kill myself.Good job
.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Smokkr - 29.08.2012
Nice tutorial, for people who can't work with zcmd(like me)
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 29.08.2012
Quote:
Originally Posted by Cjgogo
Even if it's a simple tutorial,I like it because it uses cool features of SAMP coding,lik sscanf,zcmd,etc.If I saw a tutorial that uses strcmp,strtok,I'd probably kill myself.Good job .
|
Yeah for some guys strcmp and strtok makes mad.
Where as ZCMD and YCMD and some other cmd processors are good to see+faster execution.
Quote:
Originally Posted by Smokkr
Nice tutorial, for people who can't work with zcmd(like me)
|
LOL thanks.
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
irfu - 30.08.2012
good work bro!
Hope you become a good scripter!
Re: How to create a simple announce cmd[sscanf|| Zcmd] -
Lordzy - 31.08.2012
@ irfu ,
Thanks.