06.01.2010, 17:27
Well, strtok is mostly used when youґve got more params, like /ban ID REASON.
Your command would work aswell, BUT a lot of easier and nicer method would be this:
And please, once again - using DCMD is much easier, because you dont need any strtok at all there.
Your command would work aswell, BUT a lot of easier and nicer method would be this:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmd, "/ban", true) == 0 )
{
new pid = strval(cmdtext);
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFFFFFFFF, "You need to be Admin to use /ban");
if(!IsPlayerConnected(pid)) return SendClientmessage(playerid, 0xFFFFFFFF, "Player offline");
Ban(pid);
return 1;
}
return 0;
}