Jump to content

simple gui problem


xTravax

Recommended Posts

hi this code isnt working

function openGui() 
        if guiGetVisible ( GUIEditor_Window[1] ) then -- line 100 
                guiSetVisible ( GUIEditor_Window[1], false ) 
                showCursor(false) 
                guiSetInputEnabled(false) 
        else 
                guiSetVisible ( GUIEditor_Window[1], true ) -- line 105 
                showCursor(true) 
                guiSetInputEnabled(true) 
        end 
end 
bindKey("F6","down",openGui) 

line 100: attemp to index global 'GUIEditor_Window' a nil value

please help im new to gui

Edited by Guest
Link to comment

it's already under it

i have first function which guieditor resource made and my function is already under that function so button is already created but when i click on it it doesnt output anything as it gives that error - expected element at argument 2 but got nil

Link to comment
  
function colt ( ) 
outputChatBox("Colt-45") 
end 
addEventHandler ( "onClientGUIClick", GUIEditor.button[1], colt, false ) 
  

i dont understand how would this fix the problem

the problem is it says (for addEventHandler: )element on argument 2 is nil - GUIEditor.button[1] <-- that one

and that button is already created in window but it still says that its nil

Link to comment

-- Like this ,

GUIEditor_Window = {} 
addEventHandler ( 'onClientGUIClick', resourceRoot, 
function ( ) 
if ( source == GUIEditor.button[1] ) then 
outputChatBox("Colt-45", 255, 255, 0 ) 
 end 
end 
) 
  
----- 
  
bindKey("F6","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

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