public team_select(id, key)
{
static CsTeams:team, roundloop, admin
roundloop = get_pcvar_num(gp_RetryTime) / 2
team = cs_get_user_team(id)
admin = is_user_admin(id)
team_count()
if(!admin && (team == CS_TEAM_UNASSIGNED) && (g_RoundStarted >= roundloop) && g_TeamCount[CS_TEAM_CT] && g_TeamCount[CS_TEAM_T] && !is_user_alive(id))
{
team_join(id, CS_TEAM_SPECTATOR)
client_print(id, print_center, "%L", LANG_SERVER, "JBE_TEAM_CANTJOIN")
return PLUGIN_HANDLED
}
switch(key)
{
case(0):
{
if(team == CS_TEAM_T)
return PLUGIN_HANDLED
g_PlayerReason[id] = random_num(1, 6)
team_join(id, CS_TEAM_T)
}
case(1):
{
if(team == CS_TEAM_CT || (!admin && get_bit(g_PlayerNomic, id)))
return PLUGIN_HANDLED
if(g_TeamCount[CS_TEAM_CT] < ctcount_allowed() || admin)
team_join(id, CS_TEAM_CT)
else
client_print(id, print_center, "%L", LANG_SERVER, "JBE_TEAM_CTFULL")
}
case(5):
{
user_silentkill(id)
team_join(id, CS_TEAM_SPECTATOR)
}
}
return PLUGIN_HANDLED
}
public team_join(id, CsTeams:team)
{
static restore, vgui, msgblock
restore = get_pdata_int(id, m_iVGUI)
vgui = restore & (1<<0)
if(vgui)
set_pdata_int(id, m_iVGUI, restore & ~(1<<0))
switch(team)
{
case CS_TEAM_SPECTATOR:
{
msgblock = get_msg_block(g_MsgShowMenu)
set_msg_block(g_MsgShowMenu, BLOCK_ONCE)
dllfunc(DLLFunc_ClientPutInServer, id)
set_msg_block(g_MsgShowMenu, msgblock)
set_pdata_int(id, m_fGameHUDInitialized, 1)
engclient_cmd(id, "jointeam", "6")
}
case CS_TEAM_T, CS_TEAM_CT:
{
msgblock = get_msg_block(g_MsgShowMenu)
set_msg_block(g_MsgShowMenu, BLOCK_ONCE)
engclient_cmd(id, "jointeam", (team == CS_TEAM_CT) ? "2" : "1")
engclient_cmd(id, "joinclass", "1")
set_msg_block(g_MsgShowMenu, msgblock)
g_PlayerSpect[id] = 0
}
}
if(vgui)
set_pdata_int(id, m_iVGUI, restore)
}
public team_count()
{
static CsTeams:team, last
g_TeamCount[CS_TEAM_UNASSIGNED] = 0
g_TeamCount[CS_TEAM_T] = 0
g_TeamCount[CS_TEAM_CT] = 0
g_TeamCount[CS_TEAM_SPECTATOR] = 0
g_TeamAlive[CS_TEAM_UNASSIGNED] = 0
g_TeamAlive[CS_TEAM_T] = 0
g_TeamAlive[CS_TEAM_CT] = 0
g_TeamAlive[CS_TEAM_SPECTATOR] = 0
for(new i = 1; i <= g_MaxClients; i++)
{
if(is_user_connected(i))
{
team = cs_get_user_team(i)
g_TeamCount[team]++
g_PlayerTeam[i] = team
if(is_user_alive(i))
{
g_TeamAlive[team]++
if(team == CS_TEAM_T)
last = i
}
}
else
{
g_PlayerTeam[i] = CS_TEAM_UNASSIGNED
}
}
if(g_TeamAlive[CS_TEAM_T] == 1)
{
if(last != g_PlayerLast && g_SafeTime)
{
prisoner_last(last)
}
}
else
{
if(g_Duel || g_DuelA || g_DuelB)
{
if(is_user_alive(g_DuelA))
{
set_user_rendering(g_DuelA, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
player_strip_weapons(g_DuelA)
}
if(is_user_alive(g_DuelB))
{
set_user_rendering(g_DuelB, kRenderFxNone, 0, 0, 0, kRenderNormal, 0)
player_strip_weapons(g_DuelB)
}
}
g_PlayerLast = 0
g_DuelA = 0
g_DuelB = 0
g_Duel = 0
}
}
					
					Użytkownik Avexis edytował ten post 02.09.2012 12:09


 
Dodatki SourceMod



	










