Jump to content

[HELP] How i do this.


ibootleeg

Recommended Posts

Hello, I've been trying to create, so far I can create, but when I try to use dxGUI what I had created disappears! I can not create a menu using dxGUI if someone can help me I appreciate it!

Just what I need is at least how do I create a window with button and memo ! Like this login panel:

7182.png

Link to comment

@Dealman, so i need put this on my code ?

@KRZO This is my code for tests.

Using normal MTA GUI:

  
function createMenuGUI() 
local xw, xh = guiGetScreenSize() 
local Width, Height = 473,284 
local X = (xw/2) - (Width/2) 
local Y = (xh/2) - (Height/2) 
     
window_test = guiCreateWindow(X, Y, Width, Height, "Test", false) 
     
btn_test = guiCreateButton(155, 135, 200, 30, "Test Button", false, window_test) 
end 
  
function openGUI() 
    createMenuGUI() 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), openGUI) 

Using dxGUI:

 function createMenuGUI() 
    local xw, xh = guiGetScreenSize() 
    local Width, Height = 473,284 
    local X = (xw/2) - (Width/2) 
    local Y = (xh/2) - (Height/2) 
     
    window_test = exports.dxgui_v1:dxCreateWindow(X, Y, Width, Height, "Test", tocolor(255, 255, 255, 255), "Lighter Black") 
     
    btn_test = exports.dxgui_v1:dxCreateButton(140, 135, 200, 30, "Test Button", tocolor(255,0,0,255), "default-bold", "Orange", window_test) 
end 
  
function openGUI() 
    createMenuGUI() 
end 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), openGUI) 

Result (nothing):

http://i.imgur.com/vH3K4Mq.png

Link to comment

@Dealman, thank you, it worked but when I create a button to the window, he did not appear, so the button as other things, upon entering the server only window appears.

Here is the code:

function createMenuGUI() 
    local xw, xh = guiGetScreenSize() 
    local Width, Height = 473,284 
    local X = (xw/2) - (Width/2) 
    local Y = (xh/2) - (Height/2) 
     
    window_test = exports.dxgui_v1:dxCreateWindow(X, Y, Width, Height, "Test", tocolor(255, 255, 255, 255), "Lighter Black") 
     
    btn_test = exports.dxgui_v1:dxCreateButton(10, 50, 200, 50, "Button Test", tocolor(255, 255, 255, 255), "default-bold", "Lighter Black", window_test) 
end 
  
function openGUI() 
    createMenuGUI() 
    root = getRootElement() 
end 
addEventHandler("onClientRender", root, openGUI) 

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