DrPhoX Posted February 9, 2013 Share Posted February 9, 2013 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
manve1 Posted February 9, 2013 Share Posted February 9, 2013 (edited) 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 February 9, 2013 by Guest Link to comment
Castillo Posted February 9, 2013 Share Posted February 9, 2013 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
DrPhoX Posted February 9, 2013 Author Share Posted February 9, 2013 Thank you very much for help I have yet to learn Link to comment
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