13.01.2011, 17:32
Just a basic one. Even though I recommend dcmd, or zcmd + sscanf (Easiest ever, these one I told)
pawn Код:
stock 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;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[128],idx,tmp[256];
cmd = strtok(cmdtext, idx);
if(!strcmp(cmd, "/akill", true))
{
new id;
tmp = strtok(cmdtext, idx);
id = strval(tmp);
if(strlen(tmp) == 0) return false;
else SetPlayerHealth(id, 0);
}
return 0;
}