03.03.2012, 17:36
when i type /kick 8 Reason, it kicks ID 0. Why does this happen?
pawn Code:
CMD:kick(playerid, params[]) //using ZCMD this is how your command will start off looking like.
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
SendClientMessage(playerid,COLOR_YELLOW,"Your admin level is not high enough to use this command");
return 1;
}
new adminname[MAX_PLAYER_NAME],otherplayerid,pname[24], reason[128];
GetPlayerName(otherplayerid,pname,sizeof(pname));
GetPlayerName(playerid,adminname,sizeof(adminname));
if(sscanf(params, "uz", otherplayerid, reason))
SendClientMessage(playerid, 0xFFFFFFFF, "/kick [playerid/name] [reason]");
else if(otherplayerid == INVALID_PLAYER_ID)
SendClientMessage(playerid, 0xFFFFFFFF, "This player is not connected");
else
{
new string[250];
format(string, sizeof(string), "Admin %s kicked %s | Reason: %s",adminname,pname, reason);
SendClientMessageToAll(0xFFFFFFFF,string);
Kick(otherplayerid);
}
return 1;
}