Jump to content

Script help


Recommended Posts

Posted

Alright, i got this stuff fixed up, yet i have a problem with my script, i have it showcursor and setinputenabled activated once script starts

 

addEventHandler ( "onClientGUIClick", Lobby.button[1], hideBoxes, false) 
addEventHandler ( "onClientGUIClick", Lobby.button[2], hideBoxes2, false) 
end 
showCursor(true) 
guiSetInputEnabled(false) 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), createWindow ) 
function hideBoxes ( button, state ) 
    if button == "left" and state == "up" then 
                setElementDimension ( localPlayer, 0 ) 
        guiSetEnabled(guiButtons, false) 
        guiSetEnabled(guiButtons1, false) 
    guiSetVisible(guiButtons, false)         
    guiSetVisible(guiButtons1, false) 
    showCursor(false) 
    guiSetInputEnabled(true) 
    end 
end 
  
function hideBoxes2 ( button, state ) 
    if button == "left" and state == "up" then 
            setElementDimension( localPlayer, 1 ) 
        guiSetEnabled(guiButtons, false) 
        guiSetEnabled(guiButtons1, false) 
    guiSetVisible(guiButtons, false)     
    guiSetVisible(guiButtons1, false) 
    showCursor(false) 
    guiSetInputEnabled(true) 
    end 
end  

Yet, the cursor doesn't go away and it doesn't do guiSetInputEnabled(true) upon clicking a button, why is this?

Posted
Alright, i got this stuff fixed up, yet i have a problem with my script, i have it showcursor and setinputenabled activated once script starts

 

addEventHandler ( "onClientGUIClick", Lobby.button[1], hideBoxes, false) 
addEventHandler ( "onClientGUIClick", Lobby.button[2], hideBoxes2, false) 
end 
showCursor(true) 
guiSetInputEnabled(false) 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), createWindow ) 
function hideBoxes ( button, state ) 
    if button == "left" and state == "up" then 
                setElementDimension ( localPlayer, 0 ) 
        guiSetEnabled(guiButtons, false) 
        guiSetEnabled(guiButtons1, false) 
    guiSetVisible(guiButtons, false)         
    guiSetVisible(guiButtons1, false) 
    showCursor(false) 
    guiSetInputEnabled(true) 
    end 
end 
  
function hideBoxes2 ( button, state ) 
    if button == "left" and state == "up" then 
            setElementDimension( localPlayer, 1 ) 
        guiSetEnabled(guiButtons, false) 
        guiSetEnabled(guiButtons1, false) 
    guiSetVisible(guiButtons, false)     
    guiSetVisible(guiButtons1, false) 
    showCursor(false) 
    guiSetInputEnabled(true) 
    end 
end  

Yet, the cursor doesn't go away and it doesn't do guiSetInputEnabled(true) upon clicking a button, why is this?

its no't full codes, i can't help you like this -.-

Posted (edited)

i am sure that guiSetInputEnabled must be true when the gui appears and false inside the function hideBoxes

guiSetInputEnabled ( false ) is the same as guiSetInputMode ( "allow_binds" )

guiSetInputEnabled ( true ) is the same as guiSetInputMode ( "no_binds" )

idk whats wrong with the cursor

addEventHandler ( "onClientGUIClick", Lobby.button[1], hideBoxes, false) 
addEventHandler ( "onClientGUIClick", Lobby.button[2], hideBoxes2, false) 
end 
showCursor(true) 
guiSetInputEnabled(true) -- there is a new function for this called guiSetInputMode, you can use that instead  
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource( ) ), createWindow ) 
function hideBoxes ( button, state ) 
    if button == "left" and state == "up" then 
                setElementDimension ( localPlayer, 0 ) 
        guiSetEnabled(guiButtons, false) 
        guiSetEnabled(guiButtons1, false) 
    guiSetVisible(guiButtons, false)         
    guiSetVisible(guiButtons1, false) 
    showCursor(false) 
    guiSetInputEnabled(false) 
    end 
end 
  
function hideBoxes2 ( button, state ) 
    if button == "left" and state == "up" then 
            setElementDimension( localPlayer, 1 ) 
        guiSetEnabled(guiButtons, false) 
        guiSetEnabled(guiButtons1, false) 
    guiSetVisible(guiButtons, false)     
    guiSetVisible(guiButtons1, false) 
    showCursor(false) 
    guiSetInputEnabled(false) 
    end 
end  

and it would be helpful if u provided the full code

Edited by Guest
Posted

It doesn't work because the the order in which the code is executed is relevant. You use addEventHandler on functions which have not been created at the top of the script.

Posted

Well crystal, the reason i have it in this order, i have the addEventHandler commands added in that location because its directly under my code of where it creates the GUI, and the end part ends my entire script above.

Posted

Oh, didn't notice that. Anyway, did you try outputting messages to see which parts of the code are executed when they should?

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