Hello FacePunch, I dont know directly how HUDShouldDraw things like CHUDHealth can be overwritten, like I want to make a gamemode which calls the function GM:HUDPaint directly, and I want to provide others to disable certain things of the hud with HUDShouldDraw, is it possible to do so? And how? Also, I wanted to ask if I can add in the HUDPaint hook something on the top that checks if a var is true, and when someone returns true in their hook.add, it will overwrite the HUDPaint function completely?
The only function of HUDShouldDraw is to return a boolean on whether or not a part of the hud should be drawn. If you wanted a custom health hud, you would disable CHUDHealth in HUDShouldDraw, then in hud paint draw your own hud for the health.
[QUOTE=john55223;49624957]The only function of HUDShouldDraw is to return a boolean on whether or not a part of the hud should be drawn. If you wanted a custom health hud, you would disable CHUDHealth in HUDShouldDraw, then in hud paint draw your own hud for the health.[/QUOTE]
You didn't fully understand what I meant. I want to overwrite/make a custom CHUDHealth which people can disable in my gamemode, because my 'base' hud is being drawn in GM:HUDPaint itself, not a hook. So they'd have to overwrite the function if I cant get HUDShouldDraw working.
[QUOTE=whitestar;49625070]You didn't fully understand what I meant. I want to overwrite/make a custom CHUDHealth which people can disable in my gamemode, because my 'base' hud is being drawn in GM:HUDPaint itself, not a hook. So they'd have to overwrite the function if I cant get HUDShouldDraw working.[/QUOTE]
At the time of drawing your hud health bar call the hook HUDShouldDraw with one argument: "CHUDHealth".
If it returns false then dont draw it, if else draw it, BUT check if it is NOT false (VariableOrHookCall != false) specifically, beacouse as i know it will return false or nil, and you want to draw it on nil.
[editline]28th January 2016[/editline]
Or just name it as you want.
What i mean with that is that you should call that hook with hook.Call and put an argument as for example "CustomHUDHealth".
[QUOTE=geferon;49625211]At the time of drawing your hud health bar call the hook HUDShouldDraw with one argument: "CHUDHealth".
If it returns false then dont draw it, if else draw it, BUT check if it is NOT false (VariableOrHookCall != false) specifically, beacouse as i know it will return false or nil, and you want to draw it on nil.
[editline]28th January 2016[/editline]
Or just name it as you want.
What i mean with that is that you should call that hook with hook.Call and put an argument as for example "CustomHUDHealth".[/QUOTE]
so something like
[code]
local returnedvar = hook.Call("HUDShouldDraw", GAMEMODE, "CHUDHealth") or false
[/code]
Would that do it?
Call it something different than CHUDHealth, like MyHUDHealth or so.
Also, instead of "or false" remove it if youvare going to do the != false or put "or true" if you are checking the value.
Sorry, you need to Log In to post a reply to this thread.