SA-MP Forums Archive
Admin slot - 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: Admin slot (/showthread.php?tid=273779)



Admin slot - Trucker[UK] - 03.08.2011

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


Re: Admin slot - FireCat - 03.08.2011

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;
}



Re: Admin slot - Trucker[UK] - 03.08.2011

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


Re: Admin slot - Guest3598475934857938411 - 03.08.2011

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


Re: Admin slot - Trucker[UK] - 04.08.2011

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();



Re: Admin slot - Dudits - 04.08.2011

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.


Re: Admin slot - Trucker[UK] - 04.08.2011

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


Re: Admin slot - Trucker[UK] - 06.08.2011

can anyone help me get this to work


Re: Admin slot - KoczkaHUN - 06.08.2011

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;
}



Re: Admin slot - sim_sima - 22.11.2011

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.