joubouti Posted May 15, 2015 Share Posted May 15, 2015 hi guys i made dx windows this my first time i use dxdraw and i don't know how to set window visible wiht button like "F3" any one help me please dxDrawRectangle(289, 214, 471, 295, tocolor(255, 0, 0, 132), false) dxDrawRectangle(342, 265, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(556, 265, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(556, 380, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(342, 380, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(462, 465, 104, 34, tocolor(6, 215, 247, 168), false) dxDrawText("Close", 461, 464, 566, 499, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, false, false, false, false) dxDrawText("Health And Armour", 343, 263, 474, 307, tocolor(255, 255, 255, 255), 1.20, "default", "center", "center", false, false, false, false, false) dxDrawText("GodMod", 557, 263, 688, 307, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, false, false, false, false) dxDrawText("Player Visible", 557, 378, 688, 422, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawText("Vehucle GodMod", 343, 378, 474, 422, tocolor(255, 255, 255, 255), 1.20, "default", "center", "center", false, false, false, false, false) Link to comment
darhal Posted May 15, 2015 Share Posted May 15, 2015 function drawWindow () dxDrawRectangle(289, 214, 471, 295, tocolor(255, 0, 0, 132), false) dxDrawRectangle(342, 265, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(556, 265, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(556, 380, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(342, 380, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(462, 465, 104, 34, tocolor(6, 215, 247, 168), false) dxDrawText("Close", 461, 464, 566, 499, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, false, false, false, false) dxDrawText("Health And Armour", 343, 263, 474, 307, tocolor(255, 255, 255, 255), 1.20, "default", "center", "center", false, false, false, false, false) dxDrawText("GodMod", 557, 263, 688, 307, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, false, false, false, false) dxDrawText("Player Visible", 557, 378, 688, 422, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawText("Vehucle GodMod", 343, 378, 474, 422, tocolor(255, 255, 255, 255), 1.20, "default", "center", "center", false, false, false, false, false) end isWndShowing = nil function onClientKey(btn, press) if btn ~= "F3" then return end if press and not isWndShowing then addEventHandler("onClientRender", root, drawWindow) isWndShowing = true elseif press and isWndShowing then isWndShowing = false removeEventHandler("onClientRender", root, drawWindow) end end addEventHandler("onClientKey", root, onClientKey) Link to comment
SpecT Posted May 15, 2015 Share Posted May 15, 2015 (edited) local isOpened = false function drawInterface() dxDrawRectangle(289, 214, 471, 295, tocolor(255, 0, 0, 132), false) dxDrawRectangle(342, 265, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(556, 265, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(556, 380, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(342, 380, 132, 42, tocolor(72, 1, 253, 168), false) dxDrawRectangle(462, 465, 104, 34, tocolor(6, 215, 247, 168), false) dxDrawText("Close", 461, 464, 566, 499, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, false, false, false, false) dxDrawText("Health And Armour", 343, 263, 474, 307, tocolor(255, 255, 255, 255), 1.20, "default", "center", "center", false, false, false, false, false) dxDrawText("GodMod", 557, 263, 688, 307, tocolor(255, 255, 255, 255), 1.50, "default", "center", "center", false, false, false, false, false) dxDrawText("Player Visible", 557, 378, 688, 422, tocolor(255, 255, 255, 255), 1.40, "default", "center", "center", false, false, false, false, false) dxDrawText("Vehucle GodMod", 343, 378, 474, 422, tocolor(255, 255, 255, 255), 1.20, "default", "center", "center", false, false, false, false, false) end function toggleInterface() if isOpened then removeEventHandler("onClientRender",getRootElement(),drawInterface) isOpened = false else addEventHandler("onClientRender",getRootElement(),drawInterface) isOpened = true end end bindKey("f3","down",toggleInterface) And don't forget to use relative position if you want it to fit in any resolution - sx,sy = guiGetScreenSize() Edited May 15, 2015 by Guest Link to comment
joubouti Posted May 15, 2015 Author Share Posted May 15, 2015 thx toni012899 and darhal Link to comment
SpecT Posted May 15, 2015 Share Posted May 15, 2015 thx toni012899 and darhal You're welcome! Link to comment
#RooTs Posted May 15, 2015 Share Posted May 15, 2015 added to all screens exemple local sx,sy = guiGetScreenSize() local px,py = 1280,720 -- all a screen in HD local x,y = (sx/px), (sy/py) função drawInterface ( ) dxDrawRectangle ( x*289 , y*214 , x*471 , y*295 , tocolor ( 255 , 0 , 0 , 132 ) , false ) end Link to comment
xeon17 Posted May 15, 2015 Share Posted May 15, 2015 added to all screensexemple local sx,sy = guiGetScreenSize() local px,py = 1280,720 -- all a screen in HD local x,y = (sx/px), (sy/py) function drawInterface ( ) dxDrawRectangle ( x*289 , y*214 , x*471 , y*295 , tocolor ( 255 , 0 , 0 , 132 ) , false ) end Fixed it for you. Link to comment
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