Spc Posted April 22, 2018 Posted April 22, 2018 Hey, I want to disable custom HUD (my own created) with command /showhud. These functions didn't work: addCommandHandler onPlayerCommand isPlayerHudComponentVisible("radar") Any sollution?
Spc Posted April 22, 2018 Author Posted April 22, 2018 (edited) 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 April 22, 2018 by Spc
Moderators Patrick Posted April 22, 2018 Moderators Posted April 22, 2018 (edited) 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 April 22, 2018 by Patrick2562
Spc Posted April 22, 2018 Author Posted April 22, 2018 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.
Moderators Patrick Posted April 22, 2018 Moderators Posted April 22, 2018 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) 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now