FuriouZ Posted November 3, 2013 Posted November 3, 2013 Hello I have a question, how to hide Rectangle ? I triyed with guiSetVisible ,but debug says Bad Argument @guiSetVisible client: addEventHandler("onClientRender", root, function() info_gui = dxDrawRectangle(0, 0, 218, 720, tocolor(0, 0, 0, 250), false) guiSetVisible(info_gui,false) end ) Thanks
denny199 Posted November 3, 2013 Posted November 3, 2013 You can't use variables with dxDrawing. Removing all drawing with the render: function drawFunction() dxDrawRectangle(0, 0, 218, 720, tocolor(0, 0, 0, 250), false) end addEventHandler("onClientRender", root, drawFunction ) function removeDraw() removeEventHandler("onClientRender", root, drawFunction ) end Or you can hide it on 2 ways: Variable way: drawRec = true function drawFunction() if drawRec == true then dxDrawRectangle(0, 0, 218, 720, tocolor(0, 0, 0, 250), false) end end addEventHandler("onClientRender", root, drawFunction ) function switchDraw() drawRec = not drawRec end Or the alpha way: local recAlpha = 255 function drawFunction() dxDrawRectangle(0, 0, 218, 720, tocolor(0, 0, 0, recAlpha), false) end addEventHandler("onClientRender", root, drawFunction ) function switchAlpha() if recAlpha == 255 then recAlpha = 0 elseif recAlpha == 0 then recAlpha = 255 end end
FuriouZ Posted November 3, 2013 Author Posted November 3, 2013 Thanks, but how to do that if i remove Rectangle event handler then all labels etc disapears too ? client: function drawInformationGui() dxDrawRectangle(0, 0, 218, 720, tocolor(0, 0, 0, 250), false) end addEventHandler("onClientRender", root,drawInformationGui) addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor_Label[2] = guiCreateLabel(-0.00, 0.00, 0.17, 0.12, "Information", true) guiSetFont(GUIEditor_Label[2], "sa-header") guiLabelSetColor(GUIEditor_Label[2], 198, 30, 28) guiLabelSetHorizontalAlign(GUIEditor_Label[2], "center", false) guiLabelSetVerticalAlign(GUIEditor_Label[2], "center") GUIEditor_Label[3] = guiCreateLabel(0.00, 0.12, 0.16, 0.05, "Player name:", true) guiSetFont(GUIEditor_Label[3], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor_Label[3], "center", false) guiLabelSetVerticalAlign(GUIEditor_Label[3], "center") GUIEditor_Label[4] = guiCreateLabel(0.005, 0.16, 0.16, 0.05, "Money:", true) guiSetFont(GUIEditor_Label[4], "default-bold-small") guiLabelSetHorizontalAlign(GUIEditor_Label[4], "left", false) guiLabelSetVerticalAlign(GUIEditor_Label[4], "center") end )
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