Majhol Posted June 24, 2013 Posted June 24, 2013 hi everybody I was wondering how can I bind a key to open a gui for example I wanna use F3 to open my gui and this is the gui code addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(166, 96, 545, 402, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.staticimage[1] = guiCreateStaticImage(16, 31, 152, 127, ":images/banshee.png", false, GUIEditor.window[1]) GUIEditor.staticimage[2] = guiCreateStaticImage(13, 218, 155, 143, ":images/infernus.png", false, GUIEditor.window[1]) GUIEditor.staticimage[3] = guiCreateStaticImage(206, 33, 151, 125, ":images/monster.png", false, GUIEditor.window[1]) GUIEditor.staticimage[4] = guiCreateStaticImage(207, 222, 150, 139, ":images/cheetah.png", false, GUIEditor.window[1]) GUIEditor.staticimage[5] = guiCreateStaticImage(396, 34, 130, 124, ":images/bullet.png", false, GUIEditor.window[1]) GUIEditor.staticimage[6] = guiCreateStaticImage(395, 219, 131, 142, ":images/supergt.png", false, GUIEditor.window[1]) end ) meta.xml <meta> <info author="Majhol" type="script" version="1.0.0" /> <script src="client.lua" type="client" /> </meta> I wish you can help me and thanks
Majhol Posted June 24, 2013 Author Posted June 24, 2013 this is what I reached to can u help me in it? addEventHandler("onClientResourceStart", resourceRoot, function guiToggleVisible ( ) if ( guiGetVisible ( myWindow ) == true ) then -- check if the gui element is visible guiSetVisible ( myWindow, false ) -- if it is, we hide it else guiSetVisible ( myWindow, true ) -- if not, we make it visible end end myWindow = GUIEditor.window[1] = guiCreateWindow(166, 96, 545, 402, "", false) myWindow = guiWindowSetSizable(GUIEditor.window[1], false) myWindow = GUIEditor.staticimage[1] = guiCreateStaticImage(16, 31, 152, 127, ":images/banshee.png", false, GUIEditor.window[1]) myWindow = GUIEditor.staticimage[2] = guiCreateStaticImage(13, 218, 155, 143, ":images/infernus.png", false, GUIEditor.window[1]) myWindow = GUIEditor.staticimage[3] = guiCreateStaticImage(206, 33, 151, 125, ":images/monster.png", false, GUIEditor.window[1]) myWindow = GUIEditor.staticimage[4] = guiCreateStaticImage(207, 222, 150, 139, ":images/cheetah.png", false, GUIEditor.window[1]) myWindow = GUIEditor.staticimage[5] = guiCreateStaticImage(396, 34, 130, 124, ":images/bullet.png", false, GUIEditor.window[1]) myWindow = GUIEditor.staticimage[6] = guiCreateStaticImage(395, 219, 131, 142, ":images/supergt.png", false, GUIEditor.window[1]) end ) bindKey ( source, "F3", "down", guiToggleVisible )
iPrestege Posted June 24, 2013 Posted June 24, 2013 addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(166, 96, 545, 402, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.staticimage[1] = guiCreateStaticImage(16, 31, 152, 127, ":images/banshee.png", false, GUIEditor.window[1]) GUIEditor.staticimage[2] = guiCreateStaticImage(13, 218, 155, 143, ":images/infernus.png", false, GUIEditor.window[1]) GUIEditor.staticimage[3] = guiCreateStaticImage(206, 33, 151, 125, ":images/monster.png", false, GUIEditor.window[1]) GUIEditor.staticimage[4] = guiCreateStaticImage(207, 222, 150, 139, ":images/cheetah.png", false, GUIEditor.window[1]) GUIEditor.staticimage[5] = guiCreateStaticImage(396, 34, 130, 124, ":images/bullet.png", false, GUIEditor.window[1]) GUIEditor.staticimage[6] = guiCreateStaticImage(395, 219, 131, 142, ":images/supergt.png", false, GUIEditor.window[1]) end ) bindKey('F3','down', function ( ) guiSetVisible ( GUIEditor.window[1],not guiGetVisible ( GUIEditor.window[1] ) ); showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) end ) Next time use Lua/Lua before post the code here . https://forum.multitheftauto.com/viewtopic.php?f=91&t=47897
Majhol Posted June 24, 2013 Author Posted June 24, 2013 its not working I used your code and this is my meta.xml is there something wrong?
Blaawee Posted June 24, 2013 Posted June 24, 2013 try this : local GUIEditor = { window = {}, staticimage = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(166, 96, 545, 402, "", false) guiWindowSetSizable(GUIEditor.window[1], false) GUIEditor.staticimage[1] = guiCreateStaticImage(16, 31, 152, 127, ":images/banshee.png", false, GUIEditor.window[1]) GUIEditor.staticimage[2] = guiCreateStaticImage(13, 218, 155, 143, ":images/infernus.png", false, GUIEditor.window[1]) GUIEditor.staticimage[3] = guiCreateStaticImage(206, 33, 151, 125, ":images/monster.png", false, GUIEditor.window[1]) GUIEditor.staticimage[4] = guiCreateStaticImage(207, 222, 150, 139, ":images/cheetah.png", false, GUIEditor.window[1]) GUIEditor.staticimage[5] = guiCreateStaticImage(396, 34, 130, 124, ":images/bullet.png", false, GUIEditor.window[1]) GUIEditor.staticimage[6] = guiCreateStaticImage(395, 219, 131, 142, ":images/supergt.png", false, GUIEditor.window[1]) end ) bindKey('F3','down', function ( ) guiSetVisible ( GUIEditor.window[1],not guiGetVisible ( GUIEditor.window[1] ) ); showCursor ( guiGetVisible ( GUIEditor.window[1] ) ) end )
Majhol Posted June 24, 2013 Author Posted June 24, 2013 blawee thanks much it's working! tyvm!!!!!!!!!!!
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