06.01.2010, 17:38
The easiest way is zcmd + sscanf:
Using strval to get player ID is bad way since iif you write anything instead of type integer it will return 0 and innocent palyer will be banned. Use ReturnUser or sscanf instead.
And DCMD is just command processor (like zcmd) and has nothing to do with strtok. As replacement for strtok you can use sscanf.
pawn Код:
COMMAND:ban(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new targetid;
if(sscanf(params,"u",targetid)) SendClientMessage(playerid,0xFFFFFF,"/ban playerid reason");
else if(targetid == INVALID_PLAYER_ID) SendClientMessage(playerid,0xFFFFFF,"Invalid player ID");
else
{
SendClientMessage(playerid,0xFFFFFF,"Player banned");
Ban(targetid);
}
}
else SendClientMessage(playerid,0xFFFFFF,"You are not admin");
return 1;
}
And DCMD is just command processor (like zcmd) and has nothing to do with strtok. As replacement for strtok you can use sscanf.

