Message

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

////////////////////////////////////////

// //
// Credits: //
// tostly, joropito, L//, Starsailor //
// //
////////////////////////////////////////

#include <amxmodx>

#define PLUGIN "New Plugin"


#define AUTHOR "Alucard"
#define VERSION "1.2"

enum _:ScoreInfo_Args {
PlayerID = 1,
Frags,
Deaths,
ClassID,
TeamID
}

new g_msgScoreInfo
new g_MaxPlayers
new p_MsgOn, p_MsgDelay

public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("health_armor_scoreboard", VERSION,FCVAR_SERVER|FCVAR_SPONLY)

p_MsgOn = register_cvar("has_msg_on", "1")


p_MsgDelay = register_cvar("has_msg_delay", "180.0")

g_msgScoreInfo = get_user_msgid("ScoreInfo")
register_message(g_msgScoreInfo, "Message_ScoreInfo")

register_event("Battery", "Event_Battery", "b")


register_event("Health", "Event_Health", "b")

g_MaxPlayers = get_maxplayers()

set_task(get_pcvar_float(p_MsgDelay), "MsgToPlayers", .flags="b")


}

/*Name: ScoreInfo
Structure:
byte PlayerID
short Frags
short Deaths
short ClassID?
short TeamID */
public Message_ScoreInfo(iMsgId, iMsgType, iMsgEnt)
{
new id = get_msg_arg_int(PlayerID)

set_msg_arg_int(Frags, ARG_SHORT, get_user_health(id))


set_msg_arg_int(Deaths, ARG_SHORT, get_user_armor(id))
}
Send_ScoreInfo(id, iFrags, iDeaths, iTeamID)
{
message_begin(MSG_BROADCAST, g_msgScoreInfo)
write_byte(id)
write_short(iFrags)
write_short(iDeaths)
write_short(0)
write_short(iTeamID)
message_end()
}

/*Name: Battery
Structure:
short Armor */
public Event_Battery( id )
{
Send_ScoreInfo(id, get_user_health(id), read_data(1), get_user_team(id))
}

/*Name: Health
Structure:
byte Health*/
public Event_Health( id )
{
Send_ScoreInfo(id, read_data(1), get_user_armor(id), get_user_team(id))
}

public MsgToPlayers()
{
if(get_pcvar_num(p_MsgOn) )
{
client_print(0, print_chat, "[H & A] In this server Frags & Deaths are
replaced with Health & Armor in the Scoreboard.")
}
}

You might also like