我来修正问题~~
首先 楼主的内容是
只能在没有任务的地图 单纯歹徒或者警察胜利可运用
再来 重点 当回合刷新以及连线成功刷新时 分数并不会归零
因此 我统整了~~~
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);
}