11.09.2009, 03:48
INVALID_PLAYER_ID doesn't seem to be working right.
I've got this command, along with heaps others and even if I do an invalid ID the command still gets called.
This is the code(all my other commands use the same code):
I've got this command, along with heaps others and even if I do an invalid ID the command still gets called.
This is the code(all my other commands use the same code):
pawn Code:
zcmd(kick, playerid, params[])
{
if (AccountInfo[playerid][AdminLevel] >= 1 || IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params, idx);
if (isnull(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /kick [playerid] [reason]");
return 1;
}
new targetid = strval(tmp);
new reason[128];
reason = bigstrtok(params, idx);
if (targetid != INVALID_PLAYER_ID)
{
new sendername[MAX_PLAYER_NAME];
new targetname[MAX_PLAYER_NAME];
GetPlayerName(targetid, targetname, sizeof(targetname));
GetPlayerName(playerid, sendername, sizeof(sendername));
printf("ADMIN: %s has kicked %s, Reason: %s.", sendername, targetname, reason);
format(tmp, sizeof(tmp), "ADMIN: Administrator %s has kicked %s, Reason: %s.", sendername,targetname,reason);
SendClientMessageToAll(COLOR_LIGHTRED, tmp);
Kick(targetid);
KickLog(tmp);
}
else return SendClientMessage(playerid, COLOR_RED, "Invalid Player ID!");
}
else SendClientMessage(playerid, COLOR_GREY, "You are not authorized to use that command!");
return 1;
}