ZCMD HELP
#1

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!
Reply
#2

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

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
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)