Jump to content

Script Help


Recommended Posts

Hello, so i had just recently created this GUI using GuiEditor

  
race_Panel = {} 
dd_Panel = {} 
  
showCursor(true) 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        race_Panel = guiCreateWindow(103, 192, 147, 159, "|| Race ||", false) 
        guiWindowSetMovable(race_Panel, false) 
        guiWindowSetSizable(race_Panel, false) 
  
        race_Button = guiCreateButton(9, 25, 128, 124, "", false, race_Panel) 
        guiSetAlpha(race_Button, 0.88) 
        guiSetFont(race_Button, "clear-normal") 
        guiSetProperty(race_Button, "NormalTextColour", "FFAAAAAA") 
  
  
        dd_Panel = guiCreateWindow(288, 192, 147, 159, "|| Demolition Derby ||", false) 
        guiWindowSetMovable(dd_Panel, false) 
        guiWindowSetSizable(dd_Panel, false) 
  
        dd_Button = guiCreateButton(10, 25, 128, 124, "", false, dd_Panel) 
        guiSetAlpha(dd_Button, 0.88) 
        guiSetFont(dd_Button, "clear-normal") 
        guiSetProperty(dd_Button, "NormalTextColour", "FFAAAAAA")     
    end 
    ) 
  

But what im wondering is How would i make it so that once One of the buttons are clicked, Both are hidden, i know it would use something like this, but how would i make it so once they are clicked they are removed as i dont know how to

guiSetVisible(race_button, dd_button, false)

I would assume it would be a code like this, but how do i make it after it is clicked is what i dont know.

Link to comment

What would the part of the script be though, as i tried using onClientGUIClick already and it isn't working out for me, I want it so when you click one, that specific button does a specific thing and removes the other button and windows, but i dont know exactly how to do that.

Edit: Ill give it a try, and post errors so you can see what i did wrong, im still beginner soo.

Link to comment

Alright, so i gave it a try, the GUI's load fine no prolem, but when i click the GUI it says

WARNING: guitest\client.lua:35: Bad argument @ 'setElementDimension'

WARNING: guitest\client.lua:36: Bad argument @ 'guiSetEnabled' [Expected gui-element at argument 1, got table]

WARNING: guitest\client.lua:37 Bad argument @ 'guiSetVisible' [Expected gui-element at argument 1, got table]

Here is my code for the part of the script showing this error, and the table

GuiButtons = { "Lobby.window[1]","Lobby.button[1]","Lobby.window[2]","Lobby.button[2]" }

  
function hideBoxes ( button, state ) 
    if button == "left" and state == "up" then 
                setElementDimension ( player, 1 ) 
        guiSetEnabled(GuiButtons, false) 
    guiSetVisible(GuiButtons, false)         
    end 
end 
  

As i am a noob scripter, i know i did this wrong and thats why im asking for help.

Link to comment

alright, so i modified it, it now changes dimensions, but it has this problem now.

WARNING: guitest\client.lua:36: Bad argument @ 'guiSetEnabled' [Expected gui-element at argument 1, got table]

WARNING: guitest\client.lua:37 Bad argument @ 'guiSetVisible' [Expected gui-element at argument 1, got table]

Where do i define guiButtons

Link to comment

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) Why is this?

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