Raised This Month: $32 Target: $400
 8% 

[CSGO] force hidehud command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 09-22-2022 , 11:22   [CSGO] force hidehud command
Reply With Quote #1

Is there any way to force run the command 'hidehud 9' on client?

On CSGO, this removes hp/armor and ammo count parts of hud.

Code:
// Hud Element hiding flags (possibly outdated) 
#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) 

/** 
* Sets the Hide-Hud flags of a client 
* 
* @param client        Client index. 
* @param flags        Flag to set, use one of the HIDEHUD_ hiding constants 
* @noreturn 
*/ 
stock Client_SetHideHud(client, flags) 
{ 
    SetEntProp(client, Prop_Send, "m_iHideHUD", flags); 
}
Would it work with something like this?
AuricYoutube is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 09-22-2022 , 12:26   Re: [CSGO] force hidehud command
Reply With Quote #2

PHP Code:
public void OnPluginStart()
{
    
RegConsoleCmd("sm_hidehud"Cmd_HideHUD);
}

public 
Action Cmd_HideHUD(int clientint args)
{
    if(!
client || !IsClientInGame(client) || args 1)
        return 
Plugin_Handled;

    
char buffer[4];
    
GetCmdArg(1buffersizeof(buffer));
    
int val StringToInt(buffer);
    if(
val || 11 val)
    {
        
ReplyToCommand(client"[HideHUD] Invalid value '%s' (valid: 0 - 11)"buffer);
        return 
Plugin_Handled;
    }

    
int flags GetEntProp(clientProp_Send"m_iHideHUD");
    
SetEntProp(clientProp_Send"m_iHideHUD"flags ^ (<< val));
    
ReplyToCommand(client"[HideHUD] HUD flag (1 << %i) %sabled"valflags & (<< val) ? "dis" "en");

    return 
Plugin_Handled;

__________________
Grey83 is offline
AuricYoutube
Senior Member
Join Date: Aug 2016
Location: Here
Old 09-22-2022 , 13:32   Re: [CSGO] force hidehud command
Reply With Quote #3

Quote:
Originally Posted by Grey83 View Post
PHP Code:
public void OnPluginStart()
{
    
RegConsoleCmd("sm_hidehud"Cmd_HideHUD);
}

public 
Action Cmd_HideHUD(int clientint args)
{
    if(!
client || !IsClientInGame(client) || args 1)
        return 
Plugin_Handled;

    
char buffer[4];
    
GetCmdArg(1buffersizeof(buffer));
    
int val StringToInt(buffer);
    if(
val || 11 val)
    {
        
ReplyToCommand(client"[HideHUD] Invalid value '%s' (valid: 0 - 11)"buffer);
        return 
Plugin_Handled;
    }

    
int flags GetEntProp(clientProp_Send"m_iHideHUD");
    
SetEntProp(clientProp_Send"m_iHideHUD"flags ^ (<< val));
    
ReplyToCommand(client"[HideHUD] HUD flag (1 << %i) %sabled"valflags & (<< val) ? "dis" "en");

    return 
Plugin_Handled;

Using this and typing !hidehud 9 in chat does not work. I am referring to the sv_cheats protected command hidehud 9 in console. (My server is sv_cheats 1 so it works)
AuricYoutube is offline
oqyh
Senior Member
Join Date: May 2019
Location: United Arab Emirates
Old 09-23-2022 , 10:29   Re: [CSGO] force hidehud command
Reply With Quote #4

Quote:
Originally Posted by AuricYoutube View Post
Using this and typing !hidehud 9 in chat does not work. I am referring to the sv_cheats protected command hidehud 9 in console. (My server is sv_cheats 1 so it works)
https://github.com/oqyh/Plugins-Made...r/Hud_Hider.sp
__________________
.:[ >> My Plugins << ]:.

My discord : oqyh
oqyh is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 09-23-2022 , 12:11   Re: [CSGO] force hidehud command
Reply With Quote #5

oqyh, exactly the same as what my code does, only with menu instead of chat. =)
__________________
Grey83 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:28.


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