Jump to content

[Help] clientside showCursor does not trigger


Recommended Posts

Posted

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 
); 
  

Posted

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) 

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

Posted (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 by Guest
Posted

try like that

cursortrue = isCursorShowing ( thePlayer ) 
local oppositefalse = not cursortrue 
showCursor ( thePlayer, oppositefalse ) 

Not tested

EDITED :D

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

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