SA-MP Forums Archive
Problem with ban command? - 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)
+--- Thread: Problem with ban command? (/showthread.php?tid=403977)



Problem with ban command? - hydravink - 01.01.2013

Hello.

pawn Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 5) return
        SendClientMessage(playerid, COLOR_ERROR, "[ERROR]{FFFFFF} Only level 5 admins can use this command");

    new id,
        reason[64];
   
    if(sscanf(params, "us[64]", id, reason)) return
        SendClientMessage(playerid, COLOR_ORANGE, "[USAGE]{FFFFFF} ban <id/name> <reason>");

    if(id == INVALID_PLAYER_ID) return
        SendClientMessage(playerid, COLOR_ERROR, "[ERROR]{FFFFFF} The player id you typed doesn't exist.");
       
    if(PlayerInfo[id][pBanned] = 1) return
        SendClientMessage(playerid, COLOR_ERROR, "[ERROR]{FFFFFF} The player id you typed is already banned.");
       
    new pName[MAX_PLAYER_NAME],
        pName2[MAX_PLAYER_NAME],
        string[128];

    GetPlayerName(playerid, pName, sizeof(pName));
    GetPlayerName(id, pName2, sizeof(pName2));

    format(string, sizeof(string), "[BAN] Admin '%s' permanently banned '%s' for: %s", pName, id, reason);
    SendClientMessageToAll(COLOR_LIGHTGREEN, string);
    PlayerInfo[id][pBanned] = 1;
    Ban(id);
    return 1;
}
The problem is that it will always show me "The player id you typed... "
How do I fix this?