Raised This Month: $51 Target: $400
 12% 

Solved [L4D2] Hide HUD


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
alcybery
Member
Join Date: Apr 2016
Old 06-13-2018 , 20:45   [L4D2] Hide HUD
Reply With Quote #1

I'm trying to hide HUD in L4D2 with this:
PHP Code:
#include <sourcemod>

public OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayeSpawn)
}

public 
Action:Event_PlayeSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
    
SetEntProp(GetClientOfUserId(GetEventInt(event"userid")), Prop_Send"m_iHideHUD"64);
    return 
Plugin_Continue;

It works, but it hides admin menu and shows HUD when you're dead, between map changes and is just unreliable. Is there a way to fix those problems? The goal is to hide HUD all the time.

Working code:
PHP Code:
#include <sourcemod>

#pragma semicolon 1
#pragma newdecls required

#define HIDEFLAG 64

public void OnClientPutInServer(int client)
{
    if (!
IsFakeClient(client)) CreateTimer(0.7Timer_HudGetClientUserId(client), TIMER_REPEAT);    
}

public 
Action Timer_Hud(Handle hTimerany iUser)
{
    
int client GetClientOfUserId(iUser);

    if (
client <= MaxClients && IsClientInGame(client))
    {
        if (
GetClientMenu(client) != MenuSource_None)
            
SetEntProp(clientProp_Send"m_iHideHUD"GetEntProp(clientProp_Send"m_iHideHUD") & ~HIDEFLAG); 
        else
            
SetEntProp(clientProp_Send"m_iHideHUD"HIDEFLAG); 
        return 
Plugin_Continue;
    }
    else return 
Plugin_Stop;


Last edited by alcybery; 06-26-2018 at 13:19.
alcybery is offline
 



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 04:47.


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