SA-MP Forums Archive
Admins can't ban main admin - 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: Admins can't ban main admin (/showthread.php?tid=408717)



Admins can't ban main admin - Louris - 19.01.2013

How can I make to admins can't ban main admin? My ban cmd:


Код:
CMD:ban( playerid, params[ ] )
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage( playerid, -1, "Tu ne administratorius!" );
    new
        id,
        reason[ 64 ]
    ;
    if(sscanf( params, "us[64]", id, reason ) ) return SendClientMessage( playerid, -1, "Naudojimas: /ban [Nickas] [Prieћastis]" );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Tokio ћaidėjo nėra." );
    new
        str[ 128 ],
        pName[ MAX_PLAYER_NAME ],
        aName[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
    GetPlayerName( id, pName, MAX_PLAYER_NAME );
    format( str, sizeof( str ), "%s Uћblokavo ћaidėją %s. (Prieћastis: %s)", aName, pName, reason );
    SendClientMessageToAll( -1, str );
    BanEx( id,str);
    return 1;
}
Main admin enum:
Код:
if(PlayerInfo[playerid][pPadmin] == 1)



Re: Admins can't ban main admin - RajatPawar - 19.01.2013

pawn Код:
if if(PlayerInfo[id][pPadmin] == 1) return SendClientMessage(playerid, -1 ,"You can't ban a main admin.");
Add this under the !IsPlayerConnected line.


Re: Admins can't ban main admin - [XST]O_x - 19.01.2013

pawn Код:
if(PlayerInfo[id][pAdim] == 1) return SendClientMessage(playerid, -1, "ERROR: You cannot ban a main admin.");



Re: Admins can't ban main admin - DaRk_RaiN - 19.01.2013

pawn Код:
CMD:ban( playerid, params[ ] )
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage( playerid, -1, "Tu ne administratorius!" );
    new
        id,
        reason[ 64 ]
    ;
    if(sscanf( params, "us[64]", id, reason ) ) return SendClientMessage( playerid, -1, "Naudojimas: /ban [Nickas] [Priežastis]" );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Tokio žaidejo nera." );
    if(PlayerInfo[playerid][pAdmin] < PlayerInfo[id][pAdmin]) return SendClientMessage( playerid, -1, "That admin is higher level than you." );
    new
        str[ 128 ],
        pName[ MAX_PLAYER_NAME ],
        aName[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
    GetPlayerName( id, pName, MAX_PLAYER_NAME );
    format( str, sizeof( str ), "%s Užblokavo žaideja %s. (Priežastis: %s)", aName, pName, reason );
    SendClientMessageToAll( -1, str );
    BanEx( id,str);
    return 1;
}



Re: Admins can't ban main admin - Private200 - 19.01.2013

pawn Код:
CMD:ban( playerid, params[ ] )
{
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage( playerid, -1, "Tu ne administratorius!" );
    new
        id,
        reason[ 64 ]
    ;
    if(sscanf( params, "us[64]", id, reason ) ) return SendClientMessage( playerid, -1, "Naudojimas: /ban [Nickas] [Prieћastis]" );
    if( !IsPlayerConnected( id ) || id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Tokio ћaidėjo nėra." );
    if(PlayerInfo[id][pPAdmin] == 1) return SendClientMessage(playerid, -1, " Banning Main Admin is not allowed.");
    new
        str[ 128 ],
        pName[ MAX_PLAYER_NAME ],
        aName[ MAX_PLAYER_NAME ]
    ;
    GetPlayerName( playerid, aName, MAX_PLAYER_NAME );
    GetPlayerName( id, pName, MAX_PLAYER_NAME );
    format( str, sizeof( str ), "%s Uћblokavo ћaidėją %s. (Prieћastis: %s)", aName, pName, reason );
    SendClientMessageToAll( -1, str );
    BanEx( id,str);
    return 1;
}



Re: Admins can't ban main admin - Glad2BeHere - 19.01.2013

pawn Код:
if(PlayerInfo[playerid][pAdmin] <= PlayerInfo[id][pAdmin]) return SendClientMessage(playerid, -1, "The admin is equal or higher than you");
//put this after the sccanf code .... so if the player who did the command is less or equal to the target he choose he cant do it

//or u can
if(PlayerInfo[playerid][pAdmin] > PlayerInfo[id][pAdmin])
//if u dont want a return value message