Jump to content

GUI Bind


Newbie

Recommended Posts

Hey.

I Gotta problem.

bindKey('F7','down', 
    function ( ) 
        for i = 1,20 do 
        guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) 
      end 
end 
) 

When i join my server the labels are showing and when i press F7 they hides blabla..

It need to be reversed: When i join server they are hided when press key they shows up.

Link to comment
for i = 1,20 do 
            guiSetVisible ( GUIEditor.label[i] ,false ) 
      end 
bindKey('F7','down', 
    function ( ) 
        for i = 1,20 do 
        guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) 
      end 
end 
) 

Link to comment
for i = 1,20 do 
            guiSetVisible ( GUIEditor.label[i] ,false ) 
      end 
bindKey('F7','down', 
    function ( ) 
        for i = 1,20 do 
        guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) 
      end 
end 
) 

This doesn't changed anything

Link to comment
  • Moderators

This part of the code:

for i = 1,20 do 
            guiSetVisible ( GUIEditor.label[i] ,false ) 
      end 
  

Must be placed after the gui creation as Solidsnake wanted you to do.

And when it's not working, please give us the errors poping on the screen using /debugscript 3

Link to comment
 Line: guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) 

Bad Argument @ guiSetVisible, at argument 1 got nil. 182 Line

So my code looks like this:

GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
function () 
  
//MY LABELS Bla Bla 
  
    end 
) 
  
for i = 1,20 do 
         guiSetVisible ( GUIEditor.label[i] ,false ) 
      end 
bindKey('F7','down', 
    function ( ) 
        for i = 1,20 do 
        guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) 
      end 
end 
) 

Link to comment
  • Moderators

Put this inside the event "onClientResourceStart".

for i = 1,20 do 
    guiSetVisible ( GUIEditor.label[i] ,false ) 
end 
bindKey('F7','down', 
    function ( ) 
        for i = 1,20 do 
        guiSetVisible ( GUIEditor.label[i] , not guiGetVisible ( GUIEditor.label[i] ) ) 
      end 
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...