Jump to content

Show and Hide Cursor and Window


BriGhtx3

Recommended Posts

Posted

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~

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
  • MTA Team
Posted

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

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

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
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

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

Can you tell me, what doesn't work? did you press F2 and the GUI didn't show up?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I'm afraid you are wrong, i've tested it on local server and works fine.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

No problem.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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