AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] hidehud broken? (https://forums.alliedmods.net/showthread.php?t=342083)

wsky 03-06-2023 12:54

[CS:GO] hidehud broken?
 
I am trying to hide some hud elements by doing this:
PHP Code:

SetEntProp(client,Prop_Send,"m_iHideHUD",GetEntProp(client,Prop_Send,"m_iHideHUD") | 9

I'm sure this used to work not too long ago, but now it does nothing.
Using the console command "hidehud 9" works as expected.

Bacardi 03-06-2023 14:11

Re: [CS:GO] hidehud broken?
 
Value integer 9 is in binary 1001.

So I guess, you hide HIDEHUD_WEAPONSELECTION and HIDEHUD_HEALTH
Don't know is this chart accurate.

PHP Code:

// Hud Element hiding flags
#define    HIDEHUD_WEAPONSELECTION        ( 1<<0 )    // Hide ammo count & weapon selection
#define    HIDEHUD_FLASHLIGHT            ( 1<<1 )
#define    HIDEHUD_ALL                    ( 1<<2 )
#define HIDEHUD_HEALTH                ( 1<<3 )    // Hide health & armor / suit battery
#define HIDEHUD_PLAYERDEAD            ( 1<<4 )    // Hide when local player's dead
#define HIDEHUD_NEEDSUIT            ( 1<<5 )    // Hide when the local player doesn't have the HEV suit
#define HIDEHUD_MISCSTATUS            ( 1<<6 )    // Hide miscellaneous status elements (trains, pickup history, death notices, etc)
#define HIDEHUD_CHAT                ( 1<<7 )    // Hide all communication elements (saytext, voice icon, etc)
#define    HIDEHUD_CROSSHAIR            ( 1<<8 )    // Hide crosshairs
#define    HIDEHUD_VEHICLE_CROSSHAIR    ( 1<<9 )    // Hide vehicle crosshair
#define HIDEHUD_INVEHICLE            ( 1<<10 )
#define HIDEHUD_BONUS_PROGRESS        ( 1<<11 )    // Hide bonus progress display (for bonus map challenges)
#define HIDEHUD_RADAR                ( 1<<12 )   // Hides the radar in CS1.5
#define HIDEHUD_MINISCOREBOARD      ( 1<<13 )   // Hides the miniscoreboard in CS1.5 

Try this, does it work. I don't know what you want.
PHP Code:

        int bits GetEntProp(client,Prop_Send,"m_iHideHUD");
        
bits |= (1<<0);
        
bits |= (1<<3);

        
SetEntProp(client,Prop_Send,"m_iHideHUD"bits) ; 


wsky 03-06-2023 14:42

Re: [CS:GO] hidehud broken?
 
Quote:

So I guess, you hide HIDEHUD_WEAPONSELECTION and HIDEHUD_HEALTH
Thats exactly what i'm trying to do.

Since (1<<0) | (1<<3) equals to 9 your code should do the same as mine.
Unfortunately it also doesn't work :(

As already mentioned "hidehud 9" in console hides both health and weaponselection, so the 9 shouldn't be the issue.

Did you try with your code? Maybe im doing something entirely wrong

Bacardi 03-06-2023 16:17

Re: [CS:GO] hidehud broken?
 
I couldn't hide those also, but for example HIDEHUD_ALL works what I quick test.
- It look like health and weapon is set from client-side. Not sure.

I try look it more.

Bacardi 03-06-2023 17:06

Re: [CS:GO] hidehud broken?
 
Ok, actually server is keeping those hud bits active (health, weapon select)
- Or it is client-side ? I'm confuse. Because it accept value and not change from sever side.
Code:

void CBasePlayer::UpdateClientData( void )

...

        // make sure these hud elements are always in the correct state
        m_Local.m_iHideHUD &= ~HIDEHUD_HEALTH;
        m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONSELECTION;

...


You can... counter attack by spamming it another value :(
- This is very spammy plugin now. "Called every frame by PlayerPreThink"
PHP Code:

...

    
SDKHook(clientSDKHook_PreThinkPostPreThinkPost);
...





public 
void PreThinkPost(int client)
{
    
int bits GetEntProp(client,Prop_Send,"m_iHideHUD") ;
    
bits |= (1<<0) | (1<<3);
    
SetEntProp(client,Prop_Send,"m_iHideHUD"bits) ;



oqyh 03-06-2023 21:13

Re: [CS:GO] hidehud broken?
 
Quote:

Originally Posted by wsky (Post 2800779)
I am trying to hide some hud elements by doing this:
PHP Code:

SetEntProp(client,Prop_Send,"m_iHideHUD",GetEntProp(client,Prop_Send,"m_iHideHUD") | 9

I'm sure this used to work not too long ago, but now it does nothing.
Using the console command "hidehud 9" works as expected.

https://github.com/oqyh/Plugins-Made...in/Hud%20Hider

wsky 03-07-2023 18:34

Re: [CS:GO] hidehud broken?
 
Quote:

Originally Posted by oqyh (Post 2800800)

Does this do anything different? Other than adding a menu

Quote:

Originally Posted by Bacardi (Post 2800790)
Ok, actually server is keeping those hud bits active (health, weapon select)
- Or it is client-side ? I'm confuse. Because it accept value and not change from sever side.
Code:

void CBasePlayer::UpdateClientData( void )

...

        // make sure these hud elements are always in the correct state
        m_Local.m_iHideHUD &= ~HIDEHUD_HEALTH;
        m_Local.m_iHideHUD &= ~HIDEHUD_WEAPONSELECTION;

...


Thats weird, i'm pretty sure it wasn't like that a few months ago. I wonder why they changed it like that.


Quote:

Originally Posted by Bacardi (Post 2800790)
You can... counter attack by spamming it another value :(
- This is very spammy plugin now. "Called every frame by PlayerPreThink"
PHP Code:

...

    
SDKHook(clientSDKHook_PreThinkPostPreThinkPost);
...





public 
void PreThinkPost(int client)
{
    
int bits GetEntProp(client,Prop_Send,"m_iHideHUD") ;
    
bits |= (1<<0) | (1<<3);
    
SetEntProp(client,Prop_Send,"m_iHideHUD"bits) ;



That works perfectly! Kinda sucks that it has to be done every frame, but its probably not too bad for performance


All times are GMT -4. The time now is 06:34.

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