Jump to content

help dxdraw


Recommended Posts

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
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
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 by Guest
Link to comment

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
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) 
  
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

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...