SA-MP Forums Archive
[HELP] last admin on server - 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: [HELP] last admin on server (/showthread.php?tid=469485)



[HELP] last admin on server - Luca12 - 13.10.2013

Hello how can I make example two admins are on the server and one of that admin disconnect and stay one admin and my question know is how can I make when last admin leave(disconnect)from server then it send to all players some message ? Thanks


Re: [HELP] last admin on server - Konstantinos - 13.10.2013

Replace IsPlayerAdmin with the variable you store the player's admin level.

pawn Код:
public OnPlayerDisconnect( playerid, reason )
{
    if( IsPlayerAdmin( playerid ) )
    {
        new
            count
        ;
        for( new i; i != MAX_PLAYERS; i++ )
        {
            if( IsPlayerConnected( i ) && IsPlayerAdmin( i ) && i != playerid ) count++;
        }
        if( !count) SendClientMessageToAll( -1, "All the admins have left." );
    }
    return 1;
}