PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <cstrike>
new gp_TeamRatio
new gp_CtMax
new CTCount
new TCount
public plugin_init()
{
gp_TeamRatio = register_cvar("jb_teamratio", "3")
gp_CtMax = register_cvar("jb_maxct", "6")
}
public count_teams()
{
CTCount = 0
TCount = 0
new Players[32]
new playerCount, i
get_players(Players, playerCount, "")
for (i=0; i<playerCount; i++)
{
if (is_user_connected(Players[i]))
{
if (cs_get_user_team(Players[i]) == CS_TEAM_CT) CTCount++;
if (cs_get_user_team(Players[i]) == CS_TEAM_T) TCount++;
}
}
}
bool:is_ct_allowed()
{
new count
count = ((TCount + CTCount) / get_pcvar_num(gp_TeamRatio))
if(count < 2)
count = 2
else if(count > get_pcvar_num(gp_CtMax))
count = get_pcvar_num(gp_CtMax)
if( count > CTCount )
{
remove_task(id)
return PLUGIN_CONTINUE
}
else
{
engclient_cmd(id, "chooseteam")
return PLUGIN_HANDLED
}
}
public client_disconnect(id)
{
count_teams()
}
public jointeam(id)
{
return PLUGIN_HANDLED
}
__________________