Restriction in /ban
#1

Hey guys this is my /ban cmd

pawn Code:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
    new targetid, reason[64], string[128];
    if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Reason]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
    {
    new pTargetName[24], pName[24];
    GetPlayerName(playerid,pName,24);
    GetPlayerName(targetid,pTargetName,24);
    format(string, sizeof(string), ""#COL_ORANGE"[SERVER]"#COL_LRED" Admin %s has IP banned %s: %s", pName,  pTargetName, reason);
    SendClientMessageToAll(COLOR_RED,string);
    Ban(targetid);
    }
    return 1;
}
And I want to add

( The low-ranked admins can't ban the high-ranked ones, so a trial admin can't ban the owner etc )
Reply
#2

pawn Code:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_RED,".:: You are not authorized to use this command ::.");
    new targetid, reason[64], string[128];
    if(sscanf(params, "uz", targetid, reason)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_DGREY"[CMD] / "#COL_SGREY"[PlayerID/PartOfName] [Reason]");
//this line
    if(PlayerInfo[targetid][pAdmin] >= PlayerInfo[playerid][pAdmin]) return SendClientMessage(playerid,COLOR_RED,".:: You cant ban a higher or an equal level admin::.");
//
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, ""#COL_ORANGE"[ERROR]"#COL_LRED" Player not connected!");
    {
    new pTargetName[24], pName[24];
    GetPlayerName(playerid,pName,24);
    GetPlayerName(targetid,pTargetName,24);
    format(string, sizeof(string), ""#COL_ORANGE"[SERVER]"#COL_LRED" Admin %s has IP banned %s: %s", pName,  pTargetName, reason);
    SendClientMessageToAll(COLOR_RED,string);
    Ban(targetid);
    }
    return 1;
}
Reply
#3

OH yeah thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)