Jump to content

Disabling custom HUD with /showhud


Spc

Recommended Posts

Code:

addEventHandler("onClientRender", getRootElement(), function()
	if getElementData(localPlayer, "auth:uid") then
		if isPlayerHudComponentVisible("radar") then -- the hiding don't work
			-- some DX draw
		end
	end
end)

 

Edited by Spc
Link to comment
  • Moderators
local show = true

addEventHandler("onClientRender", getRootElement(), function()
	if show and getElementData(localPlayer, "auth:uid") then
		-- some DX draw
	end
end)

addCommandHandler("showhud", function()
    show = not show
end)

 

Edited by Patrick2562
Link to comment
21 minutes ago, Patrick2562 said:

local show = true

addEventHandler("onClientRender", getRootElement(), function()
	if show and getElementData(localPlayer, "auth:uid") then
		-- some DX draw
	end
end)

addCommandHandler("showhud", function()
    show = not show
end)

 

Don't work.

Link to comment
  • Moderators
function render()
	if getElementData(localPlayer, "auth:uid") then
		-- some DX draw
	end
end
addEventHandler("onClientRender", getRootElement(), render)

local show = true
addCommandHandler("showhud", function()
	if show then
		removeEventHandler("onClientRender", getRootElement(), render)
	else
		addEventHandler("onClientRender", getRootElement(), render)
	end
    show = not show
end)

 

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...