 |
|
BANNED
Join Date: May 2012
Location: GB
|

01-02-2014
, 13:04
Re: [HELP]Return user to team.
|
#5
|
Quote:
Originally Posted by DavidJr
PHP Code:
new g_Team[33] //create global array
enum
{
T_TEAM = 1,
CT_TEAM
}
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam(Ham_Spawn, "player", "fwd_Spawn_Post", 1) // spawn forward to check user team when spawn
}
public fwd_Spawn_Post(id)
{
if (is_user_alive(id))
{
if (cs_get_user_team(id) == CS_TEAM_T) // if user team is ct
{
g_Team[id] = T_TEAM // save user team as in g_Team
}
else if (cs_get_user_team(id) == CS_TEAM_CT)
{
g_Team[id] = CT_TEAM // save user team as in g_Team
}
if (g_Team[id] == T_TEAM) // if g_Team is equal with team T
{
cs_set_user_team(id, CS_TEAM_T) //set to T
}
else
{
cs_set_user_team(id, CS_TEAM_CT) //set to CT
}
}
}
|
PHP Code:
public fwd_Spawn_Post(id)
{
if (!is_user_alive(id)) return
g_Team[id] = cs_get_user_team(id) // save user team as in g_Team
cs_set_user_team(id, g_Team[id]) //set Team
}
|
|
|
|