Jump to content

guiSetVisible not working


Recommended Posts

I made a script

  function drawPanel()

  function openandclose()
if removeEventHandler("onClientRender", root, drawPanel) then
    removEventHandler("onClientRender", root, drawPanel)
    	guiSetVisible(prev, false)
    	guiSetVisible(nxt, false)
    addEventHandler("onClientRender", root, drawPanel)
    	guiSetVisible(prev, true)
    	guiSetVisible(nxt, true)

prev = guiCreateButton(453, 335, 35, 35, "<", false)
guiSetFont (prev, "default-bold-small")

nxt = guiCreateButton(999, 335, 35, 35, ">", false)
guiSetFont (nxt, "default-bold-small")

And the buttons show up everytime if the visible or not..

The debugscript 3 says: "Attempt to call global'removeEventHandler' (a nil value)"

How to solve that?

Link to comment

Line 10 has a typo - it's removeEventHandler not removEventHandler. Besides, that line is unnecessary. The if-line above it already calls that function and its side-effects are executed (i.e. handler gets removed from the function or a false is returned because it's not attached anyway, so calling it again won't work - it'll either be removed or it wasn't attached in the first place)

Edited by MrTasty
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...