gytisan Posted February 9, 2012 Posted February 9, 2012 (edited) How can i make bind key open close for this GUI window witch F7 addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Checkbox = {} GUIEditor_Progress = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(151,53,522,505,"Welcome. Have Fun :)",false) GUIEditor_Memo[1] = guiCreateMemo(12,76,256,155,"Commands:\n\nFor repair...../r\nFor flip...../f\nFor nitro...../n\n\nWARNING: Dont spam commands.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(10,247,259,116,"Rules:\n\nDont cheat~\nDont camp~\nPlay fair~\nBe good~\nAccept~\n",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Checkbox[1] = guiCreateCheckBox(61,72,36,33,"",false,false,GUIEditor_Memo[2]) GUIEditor_Memo[3] = guiCreateMemo(11,375,258,31,"Try to be the best ))))",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Image[1] = guiCreateStaticImage(249,92,235,289,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Progress[1] = guiCreateProgressBar(20,419,478,72,false,GUIEditor_Window[1]) GUIEditor_Progress[2] = guiCreateProgressBar(17,22,484,49,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(270,165,5,5,"",false) end ) --- --- --- --- --- Edited February 9, 2012 by Guest
GanJaRuleZ Posted February 9, 2012 Posted February 9, 2012 addEventHandler("onClientResourceStart",resourceRoot, function() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Checkbox = {} GUIEditor_Progress = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(151,53,522,505,"Welcome. Have Fun ",false) GUIEditor_Memo[1] = guiCreateMemo(12,76,256,155,"Commands:\n\nFor repair...../r\nFor flip...../f\nFor nitro...../n\n\nWARNING: Dont spam commands.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(10,247,259,116,"Rules:\n\nDont cheat~\nDont camp~\nPlay fair~\nBe good~\nAccept~\n",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Checkbox[1] = guiCreateCheckBox(61,72,36,33,"",false,false,GUIEditor_Memo[2]) GUIEditor_Memo[3] = guiCreateMemo(11,375,258,31,"Try to be the best ))))",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Image[1] = guiCreateStaticImage(249,92,235,289,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Progress[1] = guiCreateProgressBar(20,419,478,72,false,GUIEditor_Window[1]) GUIEditor_Progress[2] = guiCreateProgressBar(17,22,484,49,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(270,165,5,5,"",false) end ) function showthepanel () if (guiGetVisible (GUIEditor_Window[1])) then guiSetVisible (GUIEditor_Window[1], false) showCursor (false) else guiSetVisible(GUIEditor_Window[1], true) showCursor (true) guiSetInputEnabled(true) end end bindKey ("F1", "down", showthepanel) next time use [lua] tags
Xeno Posted February 9, 2012 Posted February 9, 2012 function onResourceStart () local Window = guiGetVisible (GUIEditor_Window[1]) --We predefine a variable for Window if (Window) == true then -- If window is shown guiSetVisible ( GUIEditor_Window[1], false ) --We hide it showCursor ( false ) --We hide it's cursor else --else we.. guiSetVisible ( GUIEditor_Window[1], true ) --Show the window showCursor ( true ) --We show it's cursor end end bindKey ( "F7", "down", onResourceStart ) --And we bind it with 'f1' key
gytisan Posted February 9, 2012 Author Posted February 9, 2012 function onResourceStart () local Window = guiGetVisible (GUIEditor_Window[1]) --We predefine a variable for Window if (Window) == true then -- If window is shown guiSetVisible ( GUIEditor_Window[1], false ) --We hide it showCursor ( false ) --We hide it's cursor else --else we.. guiSetVisible ( GUIEditor_Window[1], true ) --Show the window showCursor ( true ) --We show it's cursor end end bindKey ( "F7", "down", onResourceStart ) --And we bind it with 'f1' key Where in my script paste it ?
drk Posted February 9, 2012 Posted February 9, 2012 GUIEditor_Window[1] = guiCreateWindow(151,53,522,505,"Welcome. Have Fun ",false) GUIEditor_Memo[1] = guiCreateMemo(12,76,256,155,"Commands:\n\nFor repair...../r\nFor flip...../f\nFor nitro...../n\n\nWARNING: Dont spam commands.",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) GUIEditor_Memo[2] = guiCreateMemo(10,247,259,116,"Rules:\n\nDont cheat~\nDont camp~\nPlay fair~\nBe good~\nAccept~\n",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[2],true) GUIEditor_Checkbox[1] = guiCreateCheckBox(61,72,36,33,"",false,false,GUIEditor_Memo[2]) GUIEditor_Memo[3] = guiCreateMemo(11,375,258,31,"Try to be the best ))))",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[3],true) GUIEditor_Image[1] = guiCreateStaticImage(249,92,235,289,"images/mtalogo.png",false,GUIEditor_Window[1]) GUIEditor_Progress[1] = guiCreateProgressBar(20,419,478,72,false,GUIEditor_Window[1]) GUIEditor_Progress[2] = guiCreateProgressBar(17,22,484,49,false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(270,165,5,5,"",false) guiSetVisible(GUIEditor_Window[1],false) bindKey('F1','down', function() if (guiGetVisible(GUIEditor_Window[1]) == true) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) guiSetInputEnabled(true) end end)
Xeno Posted February 9, 2012 Posted February 9, 2012 You can put my script at the bottom of yours. @Draken - there was no need for that, mine worked perfectly
Kenix Posted February 9, 2012 Posted February 9, 2012 gytisan,Full code Client side. local GUIEditor_Window = { } local GUIEditor_Memo = { } local GUIEditor_Checkbox = { } local GUIEditor_Image = { } local GUIEditor_Progress = { } local GUIEditor_Button = { } GUIEditor_Window[1] = guiCreateWindow( 151,53,522,505,"Welcome. Have Fun ",false ) GUIEditor_Memo[1] = guiCreateMemo( 12,76,256,155,"Commands:\n\nFor repair...../r\nFor flip...../f\nFor nitro...../n\n\nWARNING: Dont spam commands.",false,GUIEditor_Window[1] ) guiMemoSetReadOnly( GUIEditor_Memo[1],true ) GUIEditor_Memo[2] = guiCreateMemo( 10,247,259,116,"Rules:\n\nDont cheat~\nDont camp~\nPlay fair~\nBe good~\nAccept~\n",false,GUIEditor_Window[1] ) guiMemoSetReadOnly( GUIEditor_Memo[2],true ) GUIEditor_Checkbox[1] = guiCreateCheckBox( 61,72,36,33,"",false,false,GUIEditor_Memo[2] ) GUIEditor_Memo[3] = guiCreateMemo( 11,375,258,31,"Try to be the best ))))",false,GUIEditor_Window[1] ) guiMemoSetReadOnly( GUIEditor_Memo[3],true ) GUIEditor_Image[1] = guiCreateStaticImage( 249,92,235,289,"images/mtalogo.png",false,GUIEditor_Window[1] ) GUIEditor_Progress[1] = guiCreateProgressBar( 20,419,478,72,false,GUIEditor_Window[1] ) GUIEditor_Progress[2] = guiCreateProgressBar( 17,22,484,49,false,GUIEditor_Window[1] ) GUIEditor_Button[1] = guiCreateButton( 270,165,5,5,"",false ) guiSetVisible( GUIEditor_Window[1],false ) bindKey( 'F1','down', function( ) guiSetVisible( GUIEditor_Window[1],not guiGetVisible( GUIEditor_Window[1] ) ) showCursor( not isCursorShowing( ) ) guiSetInputEnabled( not guiGetInputEnabled( ) ) end )
drk Posted February 9, 2012 Posted February 9, 2012 You can put my script at the bottom of yours.@Draken - there was no need for that, mine worked perfectly Then, Kenix post isn't needed too, yes? ^^ Stop...
Kenix Posted February 9, 2012 Posted February 9, 2012 Where in my script paste it ? I just post full code. And it code better and shorter My bindKey( 'F1','down', function( ) guiSetVisible( GUIEditor_Window[1],not guiGetVisible( GUIEditor_Window[1] ) ) showCursor( not isCursorShowing( ) ) guiSetInputEnabled( not guiGetInputEnabled( ) ) end ) Your bindKey('F1','down', function() if (guiGetVisible(GUIEditor_Window[1]) == true) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) guiSetInputEnabled(true) end end)
drk Posted February 9, 2012 Posted February 9, 2012 Where in my script paste it ? I just post full code. And it code better and shorter My bindKey( 'F1','down', function( ) guiSetVisible( GUIEditor_Window[1],not guiGetVisible( GUIEditor_Window[1] ) ) showCursor( not isCursorShowing( ) ) guiSetInputEnabled( not guiGetInputEnabled( ) ) end ) Your bindKey('F1','down', function() if (guiGetVisible(GUIEditor_Window[1]) == true) then guiSetVisible(GUIEditor_Window[1],false) showCursor(false) guiSetInputEnabled(false) else guiSetVisible(GUIEditor_Window[1],true) showCursor(true) guiSetInputEnabled(true) end end) I know dude..
gytisan Posted February 10, 2012 Author Posted February 10, 2012 Thaaaaaaaaaaaaaaaaaaaaanks : ))))))))))))))))))))))))))))) U Alllllllllllllllll awesome :):):)
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