Mittell Buurman Posted August 4, 2013 Posted August 4, 2013 Alright, I made a closeLoginWindow event, it does work, but when it comes down to disabling the cursor, nothing happens, I made the debugstring to check if it passes through and it does, giving me the debugstring. Client: addEvent("closeLoginWindow", true) addEventHandler("closeLoginWindow", getLocalPlayer(), function() if (isElement(wdwMain)) then destroyElement(wdwMain) wdwMain, mainLogo, edtUsername, edtPassword, btnlogin, btnRegister = nil end if (isCursorShowing()) then outputDebugString("Well, showcursor is being a complete bitch!") showCursor(false) end end );
Dealman Posted August 4, 2013 Posted August 4, 2013 Instead of destroying the elements, you could use guiGetVisible and guiSetVisible. Example; function closeLoginWindow_Handler() if(guiGetVisible(wdMain) == true) then guiSetVisible(wdMain, false) showCursor(false) end end addEvent("closeLoginWindow", true) addEventHandler("closeLoginWindow", getRootElement(), closeLoginWindow_Handler)
Mittell Buurman Posted August 4, 2013 Author Posted August 4, 2013 Instead of destroying the elements, you could use guiGetVisible and guiSetVisible.Example; function closeLoginWindow_Handler() if(guiGetVisible(wdMain) == true) then guiSetVisible(wdMain, false) showCursor(false) end end addEvent("closeLoginWindow", true) addEventHandler("closeLoginWindow", getRootElement(), closeLoginWindow_Handler) Might do that, but if that fixes the showCursor issue. I'll try that.
Mittell Buurman Posted August 4, 2013 Author Posted August 4, 2013 (edited) I have tested it, but the Cursor is still showing. UPDATE: I forgot I had a guiSetInputEnabled() in the function, it's now resolved: addEvent("closeLoginWindow", true) addEventHandler("closeLoginWindow", getLocalPlayer(), function() if (isElement(wdwMain)) then showCursor(false) guiSetInputEnabled(false) destroyElement(wdwMain) wdwMain, mainLogo, edtUsername, edtPassword, btnlogin, btnRegister = nil end end ); Edited August 4, 2013 by Guest
golanu21 Posted August 4, 2013 Posted August 4, 2013 try like that cursortrue = isCursorShowing ( thePlayer ) local oppositefalse = not cursortrue showCursor ( thePlayer, oppositefalse ) Not tested EDITED
Mittell Buurman Posted August 4, 2013 Author Posted August 4, 2013 try like that cursortrue = isCursorShowing ( thePlayer ) local oppositefalse = not cursortrue showCursor ( thePlayer, oppositefalse ) Not tested EDITED I used this to test if the cursor was showing: function isTheCursorShowing() if (isCursorShowing(true)) then outputDebugString("cursor is showing") else outputDebugString("cursor is not showing") end end addCommandHandler("cursor", isTheCursorShowing) The result was that the cursor wasn't showing according to the script, but I had the guiSetInputEnabled(true) in my login GUI, after adding guiSetInputEnabled(false) in the function, the cursor disappeared.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now