Hello to everone,
This is amxx plugin that makes scoreboard display health of players instead of deaths. However, there is one problem: when player is dead, his death column shows number of deaths, instead of 0 like death man's health.
Could someone help and correct the code to show zero when a player is dead?
Here is code:
Code:
#include <amxmodx>
#define PLUGIN "Health in Deaths"
#define AUTHOR "Alucard"
#define VERSION "1.4"
#define MAX_FRAGS 32000
#define SET_FRAGS 32000
enum _:ScoreInfo_Args {
PlayerID = 1,
Frags,
Deaths,
ClassID,
TeamID
}
new g_msgScoreInfo
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_msgScoreInfo = get_user_msgid("ScoreInfo")
register_message(g_msgScoreInfo, "Message_ScoreInfo")
register_event("Health", "EventHealth", "b")
}
public Message_ScoreInfo(iMsgId, iMsgType, iMsgEnt)
{
set_msg_arg_int(Deaths, ARG_SHORT, get_user_health(get_msg_arg_int(PlayerID)) )
}
Send_ScoreInfo(id, iHealth)
{
if(iHealth > MAX_FRAGS)
iHealth = SET_FRAGS
message_begin(MSG_BROADCAST, g_msgScoreInfo)
write_byte(id)
write_short(get_user_frags(id))
write_short(iHealth)
write_short(0)
write_short(get_user_team(id))
message_end()
}
public EventHealth(id)
Send_ScoreInfo(id, read_data(1) )
Thank you