Admin slot
#1

Hello

I am asking about does anyone know how to make admin slots on the server that only e.g. 2 slots are reserved for admin only and if a normal player connects it kicks him as he is not admin/vip

Please reply
Reply
#2

You mean like convoy trucking?
If yes:
pawn Код:
new connectedplayers;
public OnPlayerConnected(playerid)
{
    if(connectedplayers == GetMaxPlayers()-2) // for 2 slots
    {  
        if(YOURADMINVARHERE < the min level the player need to have)
        {
            Kick(playerid);
            SendClientMessage(playerid,color,"Last 2 slots are for admins");
            return 1;
        }
    }
    connectedplayers++;
    return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    connectedplayers--;
    return 1;
}
Reply
#3

Quote:
Originally Posted by FireCat
Посмотреть сообщение
You mean like convoy trucking?
If yes:
pawn Код:
new connectedplayers;
public OnPlayerConnected(playerid)
{
    if(connectedplayers == GetMaxPlayers-2) // for 2 slots
    {  
        if(YOURADMINVARHERE < the min level the player need to have)
        {
            Kick(playerid);
            SendClientMessage(playerid,color,"Last 2 slots are for admins");
            return 1;
        }
    }
    connectedplayers++;
    return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    connectedplayers--;
    return 1;
}
were do i add this too the game mode or is it a filterscript
Reply
#4

You got to put it in the gamemode, don't forget to not double add these publics more then once.
Reply
#5

Quote:
Originally Posted by expertprogrammer
Посмотреть сообщение
You got to put it in the gamemode, don't forget to not double add these publics more then once.
When i added it i got this error

Код:
C:\Program Files (x86)\Rockstar Games\GTA San Andreas\SAMP\Samp\pawno\include\core.inc(12) : error 010: invalid function or declaration
but when i go into the file it show this on line

Код:
native heapspace();
Reply
#6

BTW: Add "connectedplayers++;" somewhere with the "Kick(playerid);"
Else it will reduce the connected players count by 1 (The person who got kicked) although it didn't increase the players connected count on his connect.
Reply
#7

Quote:
Originally Posted by Dudits
Посмотреть сообщение
BTW: Add "connectedplayers++;" somewhere with the "Kick(playerid);"
Else it will reduce the connected players count by 1 (The person who got kicked) although it didn't increase the players connected count on his connect.
can u show me wat it will look like
Reply
#8

can anyone help me get this to work
Reply
#9

I corrected some problems in this
Quote:
Originally Posted by FireCat
Посмотреть сообщение
You mean like convoy trucking?
If yes:
pawn Код:
new connectedplayers;
public OnPlayerConnect(playerid)
{
    if(connectedplayers == GetServerVarAsInt("maxplayers")-2) // for 2 slots
    {  
        if(YOURADMINVARHERE < the min level the player need to have)
        {
            SendClientMessage(playerid,color,"Last 2 slots are for admins");
            Kick(playerid);
            return 1;
        }
    }
    connectedplayers++;
    return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    connectedplayers--;
    return 1;
}
Reply
#10

Quote:
Originally Posted by FireCat
Посмотреть сообщение
You mean like convoy trucking?
If yes:
pawn Код:
new connectedplayers;
public OnPlayerConnected(playerid)
{
    if(connectedplayers == GetMaxPlayers()-2) // for 2 slots
    {  
        if(YOURADMINVARHERE < the min level the player need to have)
        {
            Kick(playerid);
            SendClientMessage(playerid,color,"Last 2 slots are for admins");
            return 1;
        }
    }
    connectedplayers++;
    return 1;
}

public OnPlayerDisconnect(playerid,reason)
{
    connectedplayers--;
    return 1;
}
Minor thing; You should send client message before kicking, or else the player won't see the message.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)