/**
* Created by AMXX-Stuido
* User: ITenGriTR
* Date: 25.07.2019
* Time 20.37
*/
#include <amxmodx>
#include <cstrike>
public plugin_init(){
register_plugin
("Team Spec Controller",
"1.0",
"Berk");
}
public client_putinserver(uIndex){
set_task(1.0,"pCheckUser",uIndex,_,_,"b");
}
public pCheckUser(uIndex){
if(is_user_connected(uIndex)){
new CsTeams:uTeam = cs_get_user_team(uIndex);
if(uTeam == CS_TEAM_SPECTATOR){
new lPlayers[32],lNum,lTNum;
get_players(lPlayers,lNum);
get_players(lPlayers,lTNum,"e","TERRORIST");
if(lTNum > lNum/2){
cs_set_user_team(uIndex,CS_TEAM_CT);
}
else{
cs_set_user_team(uIndex,CS_TEAM_T);
}
}
}
else{
remove_task(uIndex);
}
}