Lucario Posted May 25, 2013 Share Posted May 25, 2013 Hi i have a problem to bind a weapon shop, when i press the key nothing happen, and doesnt output any errors in the debugscript, im new with the bindKey function. addEventHandler("onClientResourceStart",resourceRoot, function() bindKey ( "F1", "down", closeShop ) end ) function closeShop() if guiGetVisible(shopWindow) then guiSetVisible(shopWindow,false) showCursor(false) end end addEventHandler ("onClientGUIClick", closeButton, closeShop) addEventHandler("onClientResourceStart",resourceRoot, function() bindKey ( "F1", "down", viewGUI ) end ) addEvent ("viewGUI", true) function viewGUI () if (getLocalPlayer() == source) then guiSetVisible (shopWindow, true) showCursor (true) end end addEventHandler ("viewGUI", getRootElement(), viewGUI) It is for Zombie Roleplay, the freeroam is OFF. Link to comment
denny199 Posted May 25, 2013 Share Posted May 25, 2013 Because you are executing two functions with f1 at the same time, one function is showing the gui and one is hiding the gui. Try this: function opencloseGUI() local state = not guiGetVisible(shopWindow) guiSetVisible(shopWindow,state) showCursor(state) end bindKey ( "F1", "down", opencloseGUI ) Link to comment
Lucario Posted May 25, 2013 Author Share Posted May 25, 2013 Thank you so mutch you help me to solve it 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