SA-MP Forums Archive
Why is this not working? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why is this not working? (/showthread.php?tid=140195)



Why is this not working? - Torran - 07.04.2010

pawn Код:
CMD:kick(playerid, params[])
{
    new id, reason;
    new string[128];
    if(!(BaseInfo[playerid][AdminLevel] > 1)) return SendClientMessage(playerid, COLOR_RED, "You are not an administrator with the required level");
    if(sscanf(params, "uz", id, reason)) return SendClientMessage(playerid, COLOR_RED, "Usage: /kick [PlayerID/PartOfName] [Reason]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "Player not Found");
    if(BaseInfo[id][AdminLevel] > 4) return SendClientMessage(playerid, COLOR_RED, "Cannot kick the Highest Level Admin");
    if(id == playerid) return SendClientMessage(playerid, COLOR_RED, "Cannot kick Yourself");
   
    format(string, sizeof string, "Administrator %s has kicked %s with reason: %s", GetPlayersName(playerid), GetPlayersName(id), reason);
    SendClientMessageToAll(COLOR_BLUE, string);
   
    Kick(id);
    return 1;
}
It lets the player kick me without a reason? Why?


Re: Why is this not working? - aircombat - 07.04.2010

Edit : Nvm


Re: Why is this not working? - Babul - 08.04.2010

the "z" parameter in sscanf is an optional string, try "us" instead of "uz". further i suggest to create the reason as string[].