BriGhtx3 Posted April 22, 2011 Share Posted April 22, 2011 Hey Guys, I have a new question : When i write /self in the chatbox, my GUI createSELF should be shown and the Cursor too. And when i write it again it should hide and the Cursor too. This is my code for the gui : addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function() GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(0,-2,800,48,"STATUS",false) guiWindowSetSizable(GUIEditor_Window[1],false) GUIEditor_TabPanel[1] = guiCreateTabPanel(78,-750,5,600,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Tab",GUIEditor_TabPanel[1]) GUIEditor_TabPanel[2] = guiCreateTabPanel(38,12,5,5,false,GUIEditor_Window[1]) GUIEditor_Tab[2] = guiCreateTab("Tab",GUIEditor_TabPanel[2]) GUIEditor_Button[1] = guiCreateButton(64,24,97,15,"JOBS",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(226,22,288,17,"BEDUERFNISSE",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Button[3] = guiCreateButton(559,22,75,16,"REGELN",false,GUIEditor_Window[1]) end) addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], showJobs ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], showBed ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], showRel ) Thanks Greetz~ Link to comment
qaisjp Posted April 22, 2011 Share Posted April 22, 2011 Add this after creating the window: guiSetVisible(GUIEditor_Window[1], false) Now add this: local misc = guiGetVisible(GUIEditor_Window[1]) guiShowCursor(not misc) guiSetVisible(GUIEditor_Window[1], not misc) to a command handler Link to comment
Castillo Posted April 22, 2011 Share Posted April 22, 2011 addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),function() GUIEditor_Window = {} GUIEditor_TabPanel = {} GUIEditor_Tab = {} GUIEditor_Button = {} GUIEditor_Window[1] = guiCreateWindow(0,-2,800,48,"STATUS",false) guiWindowSetSizable(GUIEditor_Window[1],false) guiSetVisible(GUIEditor_Window[1],false) GUIEditor_TabPanel[1] = guiCreateTabPanel(78,-750,5,600,false,GUIEditor_Window[1]) GUIEditor_Tab[1] = guiCreateTab("Tab",GUIEditor_TabPanel[1]) GUIEditor_TabPanel[2] = guiCreateTabPanel(38,12,5,5,false,GUIEditor_Window[1]) GUIEditor_Tab[2] = guiCreateTab("Tab",GUIEditor_TabPanel[2]) GUIEditor_Button[1] = guiCreateButton(64,24,97,15,"JOBS",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(226,22,288,17,"BEDUERFNISSE",false,GUIEditor_Window[1]) guiSetFont(GUIEditor_Button[2],"clear-normal") GUIEditor_Button[3] = guiCreateButton(559,22,75,16,"REGELN",false,GUIEditor_Window[1]) addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], showJobs ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], showBed ) addEventHandler ( "onClientGUIClick", GUIEditor_Button[3], showRel ) end) bindKey("F2","down", function () showCursor(not isCursorShowing()) guiSetVisible(GUIEditor_Window[1], not guiGetVisible(GUIEditor_Window[1])) end) Link to comment
BriGhtx3 Posted April 22, 2011 Author Share Posted April 22, 2011 function visible() local misc = guiGetVisible(GUIEditor_Window[1]) guiShowCursor(not misc) guiSetVisible(GUIEditor_Window[1], not misc) end addCommandHandler ( "vis", visible ) Like this? Sry i am new to lua @Solidsnake Doesn't work Link to comment
Castillo Posted April 22, 2011 Share Posted April 22, 2011 Can you tell me, what doesn't work? did you press F2 and the GUI didn't show up? Link to comment
BriGhtx3 Posted April 22, 2011 Author Share Posted April 22, 2011 Yes... But there aren't any errors shown up. Link to comment
Castillo Posted April 22, 2011 Share Posted April 22, 2011 I'm afraid you are wrong, i've tested it on local server and works fine. Link to comment
BriGhtx3 Posted April 22, 2011 Author Share Posted April 22, 2011 oO... Now it works for me too. Alright thanks for your help 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