Hugos Posted May 30, 2019 Share Posted May 30, 2019 Help. How to make the action "OnClientGUIClick" which would be closed "guiCreateStaticImage"? Link to comment
Hugos Posted May 31, 2019 Author Share Posted May 31, 2019 (edited) 10 hours ago, #BrosS said: guiSetVisible 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 May 31, 2019 by Hugos Link to comment
MrKAREEM Posted May 31, 2019 Share Posted May 31, 2019 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
#BrosS Posted May 31, 2019 Share Posted May 31, 2019 (edited) 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 May 31, 2019 by #BrosS Link to comment
Hugos Posted May 31, 2019 Author Share Posted May 31, 2019 1 час назад, #BrosS сказал: как называется кнопка, которая должна закрыть изображение BTN_GO = guiCreateStaticImage(608, 544, 150, 40, "img / btn_go.png", false) Link to comment
salh Posted May 31, 2019 Share Posted May 31, 2019 (edited) 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 May 31, 2019 by salh Link to comment
Hugos Posted May 31, 2019 Author Share Posted May 31, 2019 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
MrKAREEM Posted May 31, 2019 Share Posted May 31, 2019 2 hours ago, Hugos said: Window? what the button u want when click on it and what u want to close when click ? Link to comment
salh Posted June 1, 2019 Share Posted June 1, 2019 4 hours ago, Hugos said: Window? the window you want to close Link to comment
Hugos Posted June 1, 2019 Author Share Posted June 1, 2019 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
salh Posted June 1, 2019 Share Posted June 1, 2019 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
salh Posted June 1, 2019 Share Posted June 1, 2019 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
Hugos Posted June 1, 2019 Author Share Posted June 1, 2019 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
salh Posted June 2, 2019 Share Posted June 2, 2019 why you replacing this this function for show the dx panel 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