/ban help
#4

Alright you've convinced me here I improved a few stuff:

pawn Код:
CMD:ban(playerid, params[])
{
    new id, name[MAX_PLAYER_NAME], reason[35], name1[MAX_PLAYER_NAME], name2[MAX_PLAYER_NAME], string[128];
    if(!(PlayerInfo[playerid][pAdmin] >= 1)) return SCM(playerid, COLOR_GREY,"You are not authorized to use this command");
    if(sscanf(params,"uz", id, reason)) return SCM(playerid, COLOR_WHITE,"USAGE: /ban [playerid/partofname] [reason]");
    if(id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY,"Invalid player id");
    else
    {
        if(PlayerInfo[id][pAdmin] >= 1)
        {
            SendClientMessage(playerid,COLOR_GREY,"That player can not be banned");
            GetPlayerName(playerid, name, sizeof(name));
            format(string, 128, "AdmWarning: %s tryes banning an admin!", name);
            ABroadCast(COLOR_YELLOW,string,1);
            return 1;
        }
        GetPlayerName(playerid, name1, sizeof(name1));
        GetPlayerName(id, name2, sizeof(name2));
        format(string, sizeof(string), "AdmCmd: %s was banned by %s, reason: %s", name2, name1, reason);
        SendClientMessageToAll(COLOR_LIGHTRED, string);
        PlayerInfo[id][pLocked] = 1;
        new plrIP[16];
        GetPlayerIp(id,plrIP, sizeof(plrIP));
        SendClientMessage(id,COLOR_DBLUE,"|___________[BAN INFO]___________|");
        format(string, sizeof(string), "Your name: %s.",name2);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "Your ip is: %s.",plrIP);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "You were banned by: %s.",name1);
        SendClientMessage(id, COLOR_WHITE, string);
        format(string, sizeof(string), "You were banned for: %s.",reason);
        SendClientMessage(id, COLOR_WHITE, string);
        SendClientMessage(id,COLOR_DBLUE,"|___________[BAN INFO]___________|");
        Ban(id);
    }
    return 1;
}
Reply


Messages In This Thread
/ban help - by Chiao - 31.05.2013, 14:06
Re: /ban help - by Stanford - 31.05.2013, 15:25
Re: /ban help - by Konstantinos - 31.05.2013, 15:30
Re: /ban help - by Stanford - 31.05.2013, 15:36

Forum Jump:


Users browsing this thread: 1 Guest(s)