repeat
#1

i need help so if you type a command for ex like /vehname with no vehicle name it sends you a message "Put in the vehicle name you want. can someone show me how do that it would be wonderful thanks
Reply
#2

Here we have ZCMD:
pawn Код:
COMMAND:/vehname(playerid,params[])
{
            new Target; //defines the playerid we wanna freeze
            if(sscanf(params, "u", Target)) SendClientMessage(playerid, COLOR_LIGHTBLUE, "USAGE: /vehname [vehname]"); //tell sscanf again if the parameters/syntax is wrong to return a special message
}
we have used sscanf to check what is after the cmd you typed. If you have nothing, it will return you an error.

Now using strcmp:
pawn Код:
if(strcmp("/vehname", cmd, true) == 0)
{
        tmp = strtok(cmdtext,idx);
        if(!strlen(tmp))
        {
            return SendClientMessage(playerid,COLOR_LIGHTRED,"USAGE: /kick [id] [reason]");
        }
}
Here we will have to use strtok to check what is after the cmd.

For better performance, use sscanf(plugin) with YCMD.
Reply
#3

thanks rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)