Jump to content

Show and Hide Cursor and Window


BriGhtx3

Recommended Posts

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

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

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