Jump to content

A little help with cursor


DrPhoX

Recommended Posts

Hello, yes i'm noob in lua scripting. I created very easy script and it doesn't work :/ here is code:

function ukazKurzor() 
    showCursor( true ) 
        outputChatBox("#ffa500You pressed #ffffffF4 #ffa500and now cursor is #00dd00ENABLED!", thePlayer, getRootElement(), 255, 255, 255, true) 
end 
bindKey("F4", "down", ukazKurzor) 
  
function zakazKurzor() 
    showCursor( false ) 
        outputChatBox("#ffa500You pressed #ffffffF4 and now cursor is #ff0000DISABLED!", thePlayer, getRootElement(), 255, 255, 255, true) 
end 
bindKey("F4", "down", zakazKurzor) 

can you tell me why it doesn't work? I really don't know. I did it with help from wiki

Link to comment
bindKey('F4', 'down', 
function( ) 
if ( isCursorShowing( ) == true ) then 
outputChatBox("#ffa500You pressed #ffffffF4 and now cursor is #ff0000DISABLED!", 255, 255, 255, true) 
elseif ( isCursorShowing( ) == false ) then 
outputChatBox("#ffa500You pressed #ffffffF4 #ffa500and now cursor is #00dd00ENABLED!", 255, 255, 255, true) 
end 
end 
) 

^ client side

Edited by Guest
Link to comment

Well, the problem is that you are hidding and showing it at the same time.

bindKey ( "F4", "down", 
    function ( ) 
        local state = ( not isCursorShowing ( ) ) 
        showCursor ( state ) 
        outputChatBox ( "#ffa500You pressed #ffffffF4 #ffa500and now cursor is #00dd00".. ( state and "ENABLED" or "DISABLED" ) .."!", 255, 255, 255, true ) 
    end 
) 

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