Jump to content

[HELP!] Close GUI


Hugos

Recommended Posts

10 hours ago, #BrosS said:

I have a script like this (When you tap the text displayed and the gui is not removed)

function F_BTN_GO (button)
    if button == "left" then
        outputChatBox("hi!")
        guiSetVisible(BTN_L_A, false)
    end
end

Button (  BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)  )

Edited by Hugos
Link to comment
2 hours ago, Hugos said:

I have a script like this (When you tap the text displayed and the gui is not removed)


function F_BTN_GO (button)
    if button == "left" then
        outputChatBox("hi!")
        guiSetVisible(BTN_L_A, false)
    end
end

Button (  BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)  )

now wich button when you click on it the gui close ?

Link to comment
4 hours ago, Hugos said:

I have a script like this (When you tap the text displayed and the gui is not removed)


function F_BTN_GO (button)
    if button == "left" then
        outputChatBox("hi!")
        guiSetVisible(BTN_L_A, false)
    end
end

Button (  BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)  )

what's the button's name that's suppose to close the image

Edited by #BrosS
Link to comment
1 час назад, #BrosS сказал:

как называется кнопка, которая должна закрыть изображение

BTN_GO = guiCreateStaticImage(608, 544, 150, 40, "img / btn_go.png", false)

Link to comment
addEventHandler("onClientGUIClick", root,function()
  if(source == BTN_GO) then  
        outputChatBox("hi!")
        guiSetVisible(BTN_L_A, false)
	end
end)

--



button_go = guiCreateStaticImage(419, 240, 185, 124, ":gui/images/dx_elements/checkbox_tick.png", false) 

addEventHandler("onClientGUIClick", root,function()
  if(source == button_go) then  
        outputChatBox("hi!")
		guiSetVisible(button_go,false)
	end
end)

 

and change your button name 

guiSetVisible(your window name,false)

 

Edited by salh
Link to comment
5 hours ago, salh said:

addEventHandler("onClientGUIClick",  root, function()
  if(source ==  BTN_GO) then  
        outputChatBox("hi!")
        guiSetVisible( BTN_L_A,  false)
	end
end)

--



button_go =  guiCreateStaticImage( 419 ,  240 ,  185 ,  124 ,  ":gui/images/dx_elements/checkbox_tick.png",  false) 

addEventHandler("onClientGUIClick",  root, function()
  if(source ==  button_go) then  
        outputChatBox("hi!")
		guiSetVisible( button_go, false)
	end
end)

 

and change your button name


guiSetVisible( your window name, false)

 

Window? 

Link to comment
4 часа назад салх сказал:

окно, которое вы хотите закрыть

Я не создавал окно
 

local x,y = guiGetScreenSize()
Font = dxCreateFont("fonts/GOTHIC.ttf", 20)

addEventHandler("onClientRender", root,
    function()
        dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
        dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
        dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
        dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
    end
)

function Connect()
    showCursor(true)
    outputChatBox("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")

    BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)
    BTN_R = guiCreateStaticImage(458, 209, 140, 25, "img/btn_r.png", false)

    BTN_GO = guiCreateStaticImage(608, 544, 150, 40, "img/btn_go.png", false)
    addEventHandler("onClientGUIClick", BTN_GO, F_BTN_GO, false)
end
addEventHandler("onClientResourceStart", root, Connect)

function F_BTN_GO (button)
    if button == "left" then
        guiSetVisible(BTN_L_A, false)
    	guiSetVisible(BTN_R, false)
        triggerServerEvent ("onGreeting", getLocalPlayer())
    end
end

My script

Link to comment

you want if click button close button?


-- the button
button_go =  guiCreateStaticImage( 419 ,  240 ,  185 ,  124 ,  ":gui/images/dx_elements/checkbox_tick.png",  false) 


addEventHandler("onClientGUIClick",  root, function() -- event
  if(source ==  button_go) then  -- if player click button or StaticImage
        outputChatBox("hi!") -- send in the chat hi!
		guiSetVisible( button_go, false) -- Make The Button Disappears
	end -- close if
end) -- close function 

 

Link to comment
addEventHandler("onClientRender", root,
    function dx()
        dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
        dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
        dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
        dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
    end
)


function F_BTN_GO (button)
    if button == "left" then
        guiSetVisible(BTN_L_A, false)
    	guiSetVisible(BTN_R, false)
        triggerServerEvent ("onGreeting", getLocalPlayer())
    	removeEventHandler("onClientRender",getRootElement(),dx) -- for remove the window dx
    end
end

 

local x,y = guiGetScreenSize()
Font = dxCreateFont("fonts/GOTHIC.ttf", 20)
function dx()
        dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
        dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
        dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
        dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
end
addEventHandler("onClientRender",getRootElement(),dx) -- for add the window dx

showCursor(true)
outputChatBox("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")

BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)
BTN_R =  guiCreateStaticImage(458, 209, 140, 25, "img/btn_r.png", false)
BTN_GO =  guiCreateStaticImage(608, 544, 150, 40, "img/btn_go.png", false)



addEventHandler("onClientGUIClick",  root, function() -- event
  if(source ==  BTN_GO) then  -- if player click button or StaticImage
        guiSetVisible(BTN_L_A, false)
    	guiSetVisible(BTN_R, false)
		guiSetVisible(BTN_GO, false)
		showCursor(false)
		removeEventHandler("onClientRender",getRootElement(),dx) -- for remove the window dx
	end -- close if
end) -- close function 

try this

Link to comment
12 hours ago, salh said:

addEventHandler("onClientRender",  root,
    function dx()
        dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
        dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
        dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
        dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
    end
)


function F_BTN_GO (button)
    if button = =  "left" then
        guiSetVisible( BTN_L_A,  false)
    	guiSetVisible( BTN_R,  false)
        triggerServerEvent ("onGreeting",  getLocalPlayer())
    	removeEventHandler("onClientRender", getRootElement(), dx)  -- for remove the window dx
    end
end

 


local x, y =  guiGetScreenSize()
Font =  dxCreateFont("fonts/GOTHIC.ttf",  20)
function dx()
        dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
        dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
        dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
        dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
end
addEventHandler("onClientRender", getRootElement(), dx)  -- for add the window dx

showCursor(true)
outputChatBox("\n\n\n\n\n\n\n\n\n\n\n\n\n\n")

BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)
BTN_R =  guiCreateStaticImage(458, 209, 140, 25, "img/btn_r.png", false)
BTN_GO =  guiCreateStaticImage(608, 544, 150, 40, "img/btn_go.png", false)



addEventHandler("onClientGUIClick",  root, function() -- event
  if(source ==  BTN_GO) then  -- if player click button or StaticImage
        guiSetVisible(BTN_L_A, false)
    	guiSetVisible(BTN_R, false)
		guiSetVisible(BTN_GO, false)
		showCursor(false)
		removeEventHandler("onClientRender",getRootElement(),dx) -- for remove the window dx
	end -- close if
end) -- close function 

try this

after replacing  

1. addEventHandler("onClientRender",  root,
2. function ()

for

1. addEventHandler("onClientRender",  root,
2. function dx()

window are no longer displayed.?

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