Last Player Slot for Admins
#1

Title says it all, I am in search for an simple Script Code, Since I am releasing a very small script with about 17 player slots. I want the last player slot only remained for Administrators. I'm already experienced with Variables that can be used to count players for OnPlayerConnect and Disconnect. But I'm wondering if there is something more simple-r than that.

Example:
16 out of the 17 players are connected, the 17th player attempting to connect. Reject connection if AdminLevel is 0 or Accept connection if username has AdminLevel is 1 or higher. If one connected player leaves, (15/17 players connected) make all connections acceptable untill players connected is 16 again.

Meaning the last player slot is only available for Administrators.

Thanks in Adanced,
Rolyy.
Reply
#2

PHP код:
// Top of script
new countPlayers 0;
// OnPlayerConnect
if(countPlayers == 16)
{
    
ReadPlayerData(playerid);
    if(!
PData[playerid][pAdmin])
    {
        
SendClientMessage(playerid, -1"[SERVER]: Sorry, this slot is reserved for admin !");
        return 
Kick(playerid);
    }
}
countPlayers++;
// OnPlayerDisconnect
countPlayers--; 
Reply
#3

Newly connecting players always fill up the lowest player slots. So you could just do:

pawn Код:
if(playerid == GetMaxPlayers()-1) // -1 because if you have 17 slots, id 16 will be the highest playerid
Reply
#4

I have knowledge and I have money
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)