#include <amxmodx>
#include <amxmisc>
#define PLUGIN "HUD Customizer"
#define VERSION "0.3"
#define AUTHOR "Igoreso"
#define HIDE_HUD_FLASH (1<<1) // Hide Flashlight, add Crosshair
#define HIDE_HUD_RAHEAR (1<<3) // Hide Radar, Health & Armor, add Crosshair
#define HIDE_HUD_TIMER (1<<4) // Hide Timer
#define HIDE_HUD_MONEY (1<<5) // Hide Money
#define HIDE_HUD_CROSS (1<<6) // Hide Crosshair
new g_msgHideWeapon
new bool:g_bHideMoney
new bool:g_bHideTimer
new bool:g_bHideFlashlight
new bool:g_bHideRaHeAr
new bool:g_bHideCrosshair
new g_cvarHideMoney
new g_cvarHideTimer
new g_cvarHideFlashlight
new g_cvarHideRaHeAr
new g_cvarHideCrosshair
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
g_msgHideWeapon = get_user_msgid("HideWeapon")
register_event("ResetHUD", "onResetHUD", "b")
register_message(g_msgHideWeapon, "msgHideWeapon")
g_cvarHideMoney = register_cvar("amx_hud_hide_money", "1")
g_cvarHideTimer = register_cvar("amx_hud_hide_timer", "1")
g_cvarHideFlashlight = register_cvar("amx_hud_hide_flashlight", "1")
g_cvarHideRaHeAr = register_cvar("amx_hud_hide_radarhealtharmor", "0")
g_cvarHideCrosshair = register_cvar("amx_hud_hide_crosshair", "0")
applyCVars()
}
public onResetHUD(id)
{
new iHideFlags = GetHudHideFlags()
if(iHideFlags)
{
message_begin(MSG_ONE, g_msgHideWeapon, _, id)
write_byte(iHideFlags)
message_end()
}
applyCVars()
}
public msgHideWeapon()
{
new iHideFlags = GetHudHideFlags()
if(iHideFlags)
set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1) | iHideFlags)
}
stock GetHudHideFlags()
{
new iFlags
if(g_bHideMoney)
iFlags |= HIDE_HUD_MONEY
if(g_bHideTimer)
iFlags |= HIDE_HUD_TIMER
if(g_bHideFlashlight)
iFlags |= HIDE_HUD_FLASH
if(g_bHideRaHeAr)
iFlags |= HIDE_HUD_RAHEAR
if(g_bHideCrosshair)
iFlags |= HIDE_HUD_CROSS
return iFlags
}
stock applyCVars()
{
g_bHideMoney = bool:get_pcvar_num(g_cvarHideMoney)
g_bHideTimer = bool:get_pcvar_num(g_cvarHideTimer)
g_bHideFlashlight = bool:get_pcvar_num(g_cvarHideFlashlight)
g_bHideRaHeAr = bool:get_pcvar_num(g_cvarHideRaHeAr)
g_bHideCrosshair = bool:get_pcvar_num(g_cvarHideCrosshair)
}