|
Author
|
Message
|
|
Member
|

03-10-2013
, 13:37
where did I wrong ?
|
#1
|
I have try make limit players join team if have limit then they will get auto change team, but it's not work, I don't know why. Please teach me
Quote:
#include <amxmisc>
#include <cs_team_changer>
#define PLUGIN "Limit players"
#define VERSION "1.0"
#define AUTHOR "Test"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event( "TeamInfo", "join_team", "a")
}
public join_team()
{
new victim = read_data(1)
if(!is_user_connected(victim)) return PLUGIN_CONTINUE
new user_team[32]
new tplayers[32], ctplayers[32], tnum, ctnum;
get_players(tplayers, tnum, "e", "TERRORIST");
get_players(ctplayers, ctnum, "e", "CT");
read_data(2, user_team, 31)
switch(user_team[0])
{
case 'C':
{
if((ctnum >= 5) && (tnum < 5))
{
cs_set_team(victim, CSTEAM_TERRORIST)
}
else if((ctnum >= 5) && (tnum >= 5))
{
cs_set_team(victim, CSTEAM_SPECTATOR )
}
}
case 'T':
{
if((tnum >= 5) && (ctnum < 5))
{
cs_set_team(victim, CSTEAM_CT)
}
else if((tnum >= 5) && (ctnum >= 5))
{
cs_set_team(victim, CSTEAM_SPECTATOR)
}
}
}
return PLUGIN_CONTINUE
}
|
|
|
|
|