PHP Code:
#include < amxmodx >
#include < amxmisc >
#include < cstrike >
#include < fun >
#define PLUGIN "DeathMatch TeamBalancer"
#define VERSION "1.0"
#define AUTHOR "HBxander"
public plugin_init ( )
register_event ( "DeathMsg", "eDeath", "a" )
public eDeath ( )
{
new victim = read_data ( 2 )
new num_t, num_ct, tplayers [ 32 ], ctplayers [ 32 ]
get_players ( tplayers, num_t, "e", "TERROISTS" )
get_players ( ctplayers, num_ct, "e", "CT" )
if ( num_t - 1 < num_ct )
CheckTeam ( victim )
else if ( num_ct - 1 < num_t )
CheckTeam ( victim )
}
public respawn ( iPlayer )
spawn ( iPlayer )
public CheckTeam ( iPlayer )
{
if ( cs_get_user_team ( iPlayer ) == CS_TEAM_T )
{
cs_set_user_team ( iPlayer, CS_TEAM_CT )
set_task ( 0.5, "respawn", iPlayer )
}
else
{
cs_set_user_team ( iPlayer, CS_TEAM_T )
set_task ( 0.5, "respawn", iPlayer )
}
}
should work, not tested.
__________________