pawn Код:
new cmd[256], idx, tmp[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/akill", true) || !strcmp(cmd, "/adminkill", true) )
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,0xff0000,"Your not an admin!");
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,0xff0000,"usage /akill");
new ID = strval(tmp);
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid,0xff0000,"Player is not connected");
SetPlayerHealth(ID,0);
SendClientMessage(playerid,0xff0000,"Done!");
return 1;
}
pawn Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}