30.08.2014, 16:56
Quote:
Hmm well its not possible because in my script have almost 200+ command with strcmp
|
http://forum.sa-mp.com/showpost.php?...7&postcount=16
Furthermore, even wiki states that strtok is a deprecated function, and it should be avoided in most of the cases
Here's an example:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)//Replace OnPlayerCommandText with this callback
{
if(success)
{
return 1;
}
//Place all your strcmp commands here:
if(strcmp(cmdtext, "/help", true) == 0)
{
SendClientMessage(playerid, -1, "Available commands: ");
return 1;
}
if(strcmp(cmdtext, "/kill", true) == 0)
{
SetPlayerHealth(playerid, 0);
return 1;
}
return 0;
}
//Now you can make a zcmd command outside that callback:
CMD:hi(playerid, params[])
{
SendClientMessage(playerid, -1, "Hello World.");
return 1;
}