03.04.2009, 12:16
Quote:
Originally Posted by Rk_
And you need to define giveplayerid and use strtok.
|
pawn Код:
strtok(const string[], &index, separator = ' ')
{
new length = strlen(string);
while ((index < length) && (string[index] <= separator))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > separator) && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
pawn Код:
new
cmd[128],
id;
if(!strcmp(cmd,"/disarm",true))
{
if ([admin level]<1337)
return 0;
cmd=strtok(cmdtext,idx);
if(!strlen(cmd))
return SendClientMessage(playerid,color,"USAGE: /disarm [ID]");
id=ReturnUser(cmd);
if(!IsPlayerConnected(id))
return 0;
ResetPlayerWeapons(id);
return 1;
}