• Hiding HUD above Head
    4 replies, posted
I was wondering if there was a way to hide someone's hud above their hud (DrawPlayerInfo), and if that was possible I woud like to implement it into ULX Cloak. I've tried everything possible that I know and none of it has even come close to working. I am unsure how to toggle it on and off for a single person but I am aware that you can do it
[URL="http://wiki.garrysmod.com/page/render/RenderView"]-[/URL]snip- wrong thread, omg.
Override this with nothing if they're cloaked [url]https://github.com/FPtje/DarkRP/blob/890f6537a00e66cec520b3890ed4a64c743d0df2/gamemode/modules/hud/cl_hud.lua#L266[/url]
[QUOTE=BillyOnWiiU;49939443]Override this with nothing if they're cloaked [url]https://github.com/FPtje/DarkRP/blob/890f6537a00e66cec520b3890ed4a64c743d0df2/gamemode/modules/hud/cl_hud.lua#L266[/url][/QUOTE] I attempted to do this with a Custom HUD (the part I editted the top hook which I believe I did wrong): [CODE]function InvisToggle() hook.Call( "Invis" ) end function Invis() if ply:GetMaterial() == "models/effects/vol_light001" then return false else return true end end hook.Add( "InvisToggle", "Invis", Invis) Invis() local function DrawPlayerInfo(ply) local pos = ply:EyePos() /* pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes pos = pos:ToScreen() pos.y = pos.y - 50 -- Move the text up a few pixels to compensate for the height of the text if GAMEMODE.Config.showname and not ply:getDarkRPVar("wanted") then draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1) draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1) draw.DrawText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1) draw.DrawText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x, pos.y + 20, Color(255,255,255,200), 1) end if GAMEMODE.Config.showjob then local teamname = team.GetName(ply:Team()) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x, pos.y + 40, Color(255, 255, 255, 200), 1) end if ply:getDarkRPVar("HasGunlicense") then surface.SetMaterial(Page) surface.SetDrawColor(255,255,255,255) surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32) end*/ end [/CODE] Since ULib.invisible isn't a hook of sorts, I had to use something that cloak does and make it similar so im not sure if theres another way to do this, please help fix this dirty code xD *Note* I have minimal knowledge of lua coding atm so if that looks horrible, don't hesitate to tell me how stupid I am :D
Looking at ULib.invisible, it seems be can detect it with ply:GetTable().invis [url]https://github.com/TeamUlysses/ulib/blob/7e7d3d7a9e6fed1172c37319047fb90d38aa35f2/lua/ulib/server/player.lua#L359[/url] [lua]local function DrawPlayerInfo(ply) local pos = ply:EyePos() if (ply:GetTable().invis) then return end pos.z = pos.z + 10 pos = pos:ToScreen() pos.y = pos.y - 50 if GAMEMODE.Config.showname and not ply:getDarkRPVar("wanted") then draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1) draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1) draw.DrawText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1) draw.DrawText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x, pos.y + 20, Color(255,255,255,200), 1) end if GAMEMODE.Config.showjob then local teamname = team.GetName(ply:Team()) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x, pos.y + 40, Color(255, 255, 255, 200), 1) end if ply:getDarkRPVar("HasGunlicense") then surface.SetMaterial(Page) surface.SetDrawColor(255,255,255,255) surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32) end end[/lua]
Sorry, you need to Log In to post a reply to this thread.