複製程式
#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)
}
不知道有沒有錯@@