17.01.2010, 14:49
first of all, lower the cell amount on output to 128. Second of all use bigstrtok.
Try this:
- Awaran
pawn Код:
stock bigstrtok(const string[], &idx)
{
new length = strlen(string);
while ((idx < length) && (string[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = string[idx];
idx++;
}
result[idx - offset] = EOS;
return result;
}
pawn Код:
if(strcmp(cmd, "/akill", true) == 0 && PlayerAdminLevel[playerid] == 1337) // Admin Kill A Player
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /akill (id)");
return 1;
}
giveplayerid = strval(tmp);
if(!IsNumeric(tmp))
{
SendClientMessage(playerid, COLOR_ERROR, "USAGE: /akill (id) ID Must be a number");
return 1;
}
new output[128];
AdminKilled[giveplayerid] =1;
output = bigstrtok(cmdtext, idx);
if (IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, string, 24);
format(string, 100, "**(ADMIN KILL)** %s(%d) %s", string,giveplayerid,output);
printf("%s", string);
SendClientMessageToAll(0xFF7F50AA, string);
SetPlayerHealth(giveplayerid,0);
}
else
{
format(string, sizeof(string), "ID (%d) Is not an active player", giveplayerid);
SendClientMessage(playerid, COLOR_ERROR, string);
}
return 1;
}