Jump to content

{HELP}How can I


gytisan

Recommended Posts

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 by Guest
Link to comment
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

Link to comment
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 

Link to comment
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 ?

Link to comment
  
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) 

Link to comment

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 
) 

Link to comment
Where in my script paste it ?

I just post full code.

And it code better and shorter :P

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) 

Link to comment
Where in my script paste it ?

I just post full code.

And it code better and shorter :P

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

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