|
[php]#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#define PLUGIN "Team Change"
#define AUTHOR "Jim"
#define VERSION "1.0"
new g_maxplayers
new g_round
new g_pcvar_tcl
new g_limitteams
new g_autobalance
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_event("TextMsg", "round_restart", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
register_logevent("round_end", 2, "1=Round_End")
g_pcvar_tcl = register_cvar("teamchange_level", "8")
g_maxplayers = get_maxplayers()
}
public round_restart()
{
g_round = 0
}
public round_end()
{
g_round++
if(g_round % get_pcvar_num(g_pcvar_tcl))
{
g_limitteams = get_cvar_num("mp_limitteams")
g_autobalance = get_cvar_num("mp_autoteambalance")
set_cvar_num("mp_limitteams", 0)
set_cvar_num("mp_autoteambalance", 0)
change_team(1)
}
}
public change_team(id)
{
if(is_user_connected(id))
{
new CsTeams:team
team = cs_get_user_team(id)
if(team == CS_TEAM_T)
cs_set_user_team(id, CS_TEAM_CT)
else if(team == CS_TEAM_CT)
cs_set_user_team(id, CS_TEAM_T)
if(is_user_alive(id))
user_silentkill(id)
}
new next = id + 1
while(next <= g_maxplayers)
{
if(is_user_connected(next))
{
set_task(0.1, "change_team", next)
break
}
else next++
}
if(next > g_maxplayers)
{
set_cvar_num("mp_limitteams", g_limitteams)
set_cvar_num("mp_autoteambalance", g_autobalance)
}
}[/php]
麻烦一下jim_yang楼主,我想知道插件能不能改成这样:比如说我设定每一幅地图的最大时间为60分钟,但60分钟内能打多少局我们都不知道,但可以肯定的是半场时间为30分钟。所以能否把以局数来计算改为以时间来计算,即让每幅地图都可以分为上下半场,半场过后双方队伍就自动换边。("teamchange_level", "8") // 能否把以局数来计算改为以时间来计算?即把8局改为8分钟。 |
|