AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   HUD How to hide stuff properly? (https://forums.alliedmods.net/showthread.php?t=102682)

Multiply 09-05-2009 02:45

HUD How to hide stuff properly?
 
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(1ARG_BYTEget_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)  -  crosshairammoweapons list
  
2   (1<<1)  -  flashlight, +
  
4   (1<<2)  -  ALL
  8   
(1<<3)  -  radarhealtharmor, +
 
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.


All times are GMT -4. The time now is 15:08.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.