SA-MP Forums Archive
ZCMD HELP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: ZCMD HELP (/showthread.php?tid=265247)



ZCMD HELP - ppeterpp - 30.06.2011

Hy. How can i use sub commands in zcmd?
Like


Код:
if(strcmp(cmd, "/check", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
	        new x_nr[256];
			x_nr = strtok(cmdtext, idx);
			if(!strlen(x_nr))
			{
				SendClientMessage(playerid, COLOR_WHITE, "USAGE: /check [what]");
    			SendClientMessage(playerid, COLOR_WHITE, "Can be checked : smthing, car etc.");
				return 1;
			}
		    if(strcmp(x_nr,"car",true) == 0 || strcmp(x_nr,"kar",true) == 0)
Thanks for helping!


Re: ZCMD HELP - Jochemd - 30.06.2011

Everything what's typed after the command is stored in 'params'. Example: when a player types "/check car" the params contain "car".


Re: ZCMD HELP - ppeterpp - 30.06.2011

Quote:
Originally Posted by Jochemd
Посмотреть сообщение
Everything what's typed after the command is stored in 'params'. Example: when a player types "/check car" the params contain "car".
can you write me an example please?

if i see it's easyer to understand how it works


Re: ZCMD HELP - Shadoww5 - 30.06.2011

PHP код:
CMD:check(playeridparams[])
{
    new 
text[128];
    if(
sscanf(params"s[128]"text))
        return 
SendClientMessageToAll(playerid0xFF0000FF"USE: /check [text]");
    if(
strcmp(text"car"true) == 0)
    {
        
// FUNCTIONS
    
}
    else if(
strcmp(text"kar"true) == 0)
    {
        
// FUNCTIONS
    
}
    else return 
SendClientMessage(playerid0xFF0000FF"You can only use \"car\" or \"kar\".");
    return 
1;

If you still don't understand, ask me and I will explain.