My problem is that I need to hide health/armor/money/ammo, and sometimes even the radar, depending on the users team and current effects applied to the user.
How do I do this in a proper way?
Using (1<<0) in the following code, makes you unable to change weapon, using slot1, and so on. (weapon_knife in console works, for example). I might be able to fix this issue, by setting pev_weapons?
At the moment I use this method to hide stuff:
PHP Code:
new gmsgHideWeapon;
new giHardcore;
..
gmsgHideWeapon = get_user_msgid("HideWeapon");
giHardcore = 1; // This is normally a cache of the pcvar, which is reset on every roundend.
register_message(gmsgHideWeapon, "eventPlayerHudHide");
..
public eventPlayerHudHide()
if (giHardcore)
set_msg_arg_int(1, ARG_BYTE, get_msg_arg_int(1) | (1<<0) | (1<<1) | (1<<3) | (1<<4) | (1<<5));
You can hide different stuff like this:
PHP Code:
1 (1<<0) - crosshair, ammo, weapons list
2 (1<<1) - flashlight, +
4 (1<<2) - ALL
8 (1<<3) - radar, health, armor, +
16 (1<<4) - timer, +
32 (1<<5) - money, +
64 (1<<6) - crosshair
128 (1<<7) - +
EDIT:
I found a solution, not regarding hiding the stuff, more about fixing the hud.
__________________