我來修正問題~~
首先 樓主的內容是
只能在沒有任務的地圖 單純歹徒或者警察勝利可運用
再來 重點 當回合刷新以及連線成功刷新時 分數並不會歸零
因此 我統整了~~~
1.爆破 人質 VIP 各種回合結束計分
2.回合刷新以及連線成功刷新歸零
補充 HUD優先權已設定 除非畫面太花 不然不太會一直閃個不停
以上
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "記分板及剩餘人數"
#define VERSION "1.0"
#define AUTHOR "MeiX"
const OFFSET_CSTEAMS = 114
const OFFSET_LINUX = 5
enum
{
FM_CS_TEAM_UNASSIGNED = 0,
FM_CS_TEAM_T,
FM_CS_TEAM_CT,
FM_CS_TEAM_SPECTATOR
}
new ct_win,tr_win,c_win,t_win,ctt_win,trr_win,cttt_win,trrr_win,ctttt_win,trrrr_win,g_maxplayers
public plugin_init()
{
register_plugin(PLUGIN,VERSION,AUTHOR)
register_message(get_user_msgid("TextMsg"), "message_textmsg")
g_maxplayers = get_maxplayers()
set_task(1.0, "show_hud_client", _, _, _, "b")
}
public message_textmsg()
{
static textmsg[22]
get_msg_arg_string(2, textmsg, charsmax(textmsg))
if (equal(textmsg, "#Terrorists_Win")) tr_win += 1
if (equal(textmsg, "#CTs_Win")) ct_win += 1
if (equal(textmsg, "#Target_Bombed")) t_win += 1
if (equal(textmsg, "#Bomb_Defused")) c_win += 1
if (equal(textmsg, "#Target_Saved")) ctt_win += 1
if (equal(textmsg, "#Hostages_Not_Rescued")) trr_win += 1
if (equal(textmsg, "#All_Hostages_Rescued")) cttt_win += 1
if (equal(textmsg, "#VIP_Assassinated")) trrr_win += 1
if (equal(textmsg, "#VIP_Not_Escaped")) trrrr_win += 1
if (equal(textmsg, "#VIP_Escaped")) ctttt_win += 1
// Game restarting/Game commencing, reset scores
if (equal(textmsg, "#Game_will_restart_in") || equal(textmsg, "#Game_Commencing"))
{
tr_win = 0
ct_win = 0
t_win = 0
c_win = 0
ctt_win = 0
trr_win = 0
cttt_win = 0
trrr_win = 0
trrrr_win = 0
ctttt_win = 0
}
}
public show_hud_client()
{
for (new id = 1; id <= g_maxplayers; id++)
{
set_hudmessage(0, 255, 0, -1.0, 0.015, 0, 6.0, 1.1, 0.0, 0.1, -1)
show_hudmessage(id, "\__反恐小組%d局 [目前%d局結束] 恐怖份子%d局__/^n\__反恐小組%d人 恐怖份子%d人__/", ct_win+c_win+ctt_win+cttt_win+ctttt_win, ct_win+c_win+ctt_win+cttt_win+ctttt_win+tr_win+t_win+trr_win+trrr_win+trrrr_win, tr_win+t_win+trr_win+trrr_win+trrrr_win, GetTotalPlayer(2, 1), GetTotalPlayer(1, 1))
}
}
GetTotalPlayer(team, alive)
{
// team: 1 is TE, 2 is CT, 3 is Zombie, 4 is Human, 0 is all
// alive: 0 is death and alive, 1 is alive
static total, id
total = 0
for (id = 1; id <= g_maxplayers; id++)
{
if ( (alive && is_user_alive(id)) || (!alive && is_user_connected(id)) )
{
if (
team == 1 && fm_cs_get_user_team(id) == FM_CS_TEAM_T ||
team == 2 && fm_cs_get_user_team(id) == FM_CS_TEAM_CT ||
team == 0
) total++
}
}
return total;
}
stock fm_cs_get_user_team(id)
{
return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
}