GetCursorMovedOn
Jump to navigation
Jump to search
This function checks in which way the cursor is currently moving, it's updated version of https://wiki.multitheftauto.com/wiki/GetCursorMoveOn.
Syntax
string getCursorMoveOn( )
Returns
Returns "left", "right", "up" or "down", "nil" if cursor didn't move.
Code
Click to collapse [-]
Function sourcelocal cP = { x = 0, y = 0, move = nil, timer = false, } function getCursorMoveOn() return cP.move end function onClientCursorMoved(cursorX, cursorY) if not isCursorShowing() then return end if cursorX > cP.x then cP.move = "right" elseif cursorX < cP.x then cP.move = "left" elseif cursorY > cP.y then cP.move = "up" elseif cursorY < cP.y then cP.move = "down" end cP.x = cursorX cP.y = cursorY if isTimer(cP.timer) then killTimer(cP.timer) end cP.timer = setTimer( function () cP.move = "nil" end, 50, 1 ) end addEventHandler("onClientCursorMove",root,onClientCursorMove)