/*
#define HIDEHUD_WEAPONSELECTION (1<<0) // 1 Hide ammo count & weapon selection
#define HIDEHUD_FLASHLIGHT (1<<1) // 2
#define HIDEHUD_ALL (1<<2) // 4
#define HIDEHUD_HEALTH (1<<3) // 8 Hide health & armor / suit battery
#define HIDEHUD_PLAYERDEAD (1<<4) // 16 Hide when local player's dead
#define HIDEHUD_NEEDSUIT (1<<5) // 32 Hide when the local player doesn't have the HEV suit
#define HIDEHUD_MISCSTATUS (1<<6) // 64 Hide miscellaneous status elements (trains, pickup history, death notices, etc)
#define HIDEHUD_CHAT (1<<7) // 128 Hide all communication elements (saytext, voice icon, etc)
#define HIDEHUD_CROSSHAIR (1<<8) // 256 Hide crosshairs
#define HIDEHUD_VEHICLE_CROSSHAIR (1<<9) // 512 Hide vehicle crosshair
#define HIDEHUD_INVEHICLE (1<<10) // 1024
#define HIDEHUD_BONUS_PROGRESS (1<<11) // 2048 Hide bonus progress display (for bonus map challenges)
*/
int iMode;
public void OnPluginStart()
{
ConVar cvar;
(cvar = CreateConVar("sm_hidehud", "0", _, _, true, _, true, 4095.0)).AddChangeHook(CVarChanged);
iMode = cvar.IntValue;
HookEvent("player_spawn", Event_PlayerSpawn);
}
public void CVarChanged(ConVar cvar, const char[] oldValue, const char[] newValue)
{
iMode = cvar.IntValue;
}
public void Event_PlayerSpawn(Event event, const char[] sName, bool bDontBroadcast)
{
RequestFrame(RequestFrame_Callback, event.GetInt("userid"));
}
public void RequestFrame_Callback(any client)
{
static int m_iHideHUD;
if((client = GetClientOfUserId(client)) && !IsClientSourceTV(client))
{
if(!m_iHideHUD) m_iHideHUD = FindDataMapInfo(client, "m_iHideHUD");
if(m_iHideHUD == -1) SetFailState("Can't find offset 'm_iHideHUD'!");
SetEntData(client, m_iHideHUD, GetEntData(client, m_iHideHUD)|iMode);
}
}