复制程式
#include <amxmodx>
#include <cstrike>
public plugin_init() register_logevent("logevent_round_end", 2, "1=Round_End") // 回合完结event
public logevent_round_end()
{
new ct = 0, tr = 0
for (new id=1;id<=get_maxplayers();id++)
{
if (!is_user_connected(id)) continue; // 无视不在的玩家
if (ct == 0 && cs_get_user_team(id) == CS_TEAM_CT)
{
ct = id // 先把第1个找到的ct纪录下来
continue;
}
if (tr == 0 && cs_get_user_team(id) == CS_TEAM_T)
{
tr = id // 先把第1个找到的tr纪录下来
continue;
}
if (cs_get_user_team(id) == CS_TEAM_T) cs_set_user_team(id, CS_TEAM_CT) // tr队的换成ct
if (cs_get_user_team(id) == CS_TEAM_CT) cs_set_user_team(id, CS_TEAM_T) // ct队的换成tr
}
// 别忘了最初的ct跟tr也要转队= =
cs_set_user_team(ct, CS_TEAM_T)
cs_set_user_team(tr, CS_TEAM_CT)
}
不知道有没有错@@