Raised This Month: $ Target: $400
 0% 

[REQ] Limit admins on server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 08-14-2011 , 17:20   [REQ] Limit admins on server
Reply With Quote #1

Hi

Running 14 servers and i need a plugin that limits the number of admins on the server at the same time. Sometimes 5 admins are playing on server #1 but none on server #2.

With a plugin like this i could limit all servers so only like 2-3 admins can connect and play at the same time on each server, i would get a nice spread.

I have no requirements, just need to have the possibility to change the limit on my own with a cvar and maybe change what flag it should count as admin and maybe a "To many admins online on this server" message when an admin is trying to connect to full server.

I hope someone could help me with this, THX!
Ejziponken is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-14-2011 , 17:51   Re: [REQ] Limit admins on server
Reply With Quote #2

Cvars:

limitadmins_max 3
limitadmins_flag "c"

PHP Code:
#include <amxmodx>

new cvarMaxAdmins
new cvarAdminFlag

public plugin_init()
{
    
register_plugin("Limit Admins on Server""0.1""Fysiks")
    
cvarMaxAdmins register_cvar("limitadmins_max""3")
    
cvarAdminFlag register_cvar("limitadmins_flag""c")
}

public 
client_putinserver(id)
{
    new 
szFlag[3]
    
get_pcvar_string(cvarAdminFlagszFlagcharsmax(szFlag))
    new 
iFlagiMax
    iFlag 
read_flags(szFlag)
    
iMax get_pcvar_num(cvarMaxAdmins)
    
    new 
iPlayers[32], iNumPlayersiAdminCount
    get_players
(iPlayersiNumPlayers)
    
    for( new 
0iNumPlayersi++ )
    {
        if( 
get_user_flags(iPlayers[i]) & iFlag )
        {
            
iAdminCount++
        }
    }
    
    if( 
iAdminCount iMax )
    {
        
server_cmd("kick #%d ^"To many admins online on this server.^""get_user_userid(id))
    }

You can compile it here.
__________________
fysiks is offline
ANTICHRISTUS
kingdom of weird stuff
Join Date: Jun 2010
Location: My kingdom is not in thi
Old 08-15-2011 , 08:42   Re: [REQ] Limit admins on server
Reply With Quote #3

https://forums.alliedmods.net/showpo...33&postcount=2
__________________
ANTICHRISTUS is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 08-15-2011 , 11:42   Re: [REQ] Limit admins on server
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
Cvars:

limitadmins_max 3
limitadmins_flag "c"

PHP Code:
#include <amxmodx>

new cvarMaxAdmins
new cvarAdminFlag

public plugin_init()
{
    
register_plugin("Limit Admins on Server""0.1""Fysiks")
    
cvarMaxAdmins register_cvar("limitadmins_max""3")
    
cvarAdminFlag register_cvar("limitadmins_flag""c")
}

public 
client_putinserver(id)
{
    new 
szFlag[3]
    
get_pcvar_string(cvarAdminFlagszFlagcharsmax(szFlag))
    new 
iFlagiMax
    iFlag 
read_flags(szFlag)
    
iMax get_pcvar_num(cvarMaxAdmins)
    
    new 
iPlayers[32], iNumPlayersiAdminCount
    get_players
(iPlayersiNumPlayers)
    
    for( new 
0iNumPlayersi++ )
    {
        if( 
get_user_flags(iPlayers[i]) & iFlag )
        {
            
iAdminCount++
        }
    }
    
    if( 
iAdminCount iMax )
    {
        
server_cmd("kick #%d ^"To many admins online on this server.^""get_user_userid(id))
    }

You can compile it here.

Thx, that works good!
Ejziponken is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:36.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode