Jump to content

[Re-request]Cursor/Mouse velocity [Closed in BUGTRACKER]


Z_ReC

Recommended Posts

Hello :fadein: , sorry for bothering with this topic, but it started a few days ago a report in the bugtracker

this -> http://bugs.mtasa.com/view.php?id=8933

& they closed it, without being able to answer some things..

I recreated the function devised by "qaisjp" in the report. (or at least I think so :lol:)

local mouseSpeed = 0 
local timerMouseSpeedUpdt = 0 
local last = {["x"] = 0, ["y"] = 0} 
addEventHandler("onClientPreRender", root, 
    function(deltaT) 
        local current = {} 
        current.x, current.y = getCursorPosition() 
        if not current.x then return end 
        mouseSpeed = math.sqrt(math.pow((last.x - current.x) / deltaT, 2)+math.pow((last.y - current.y) / deltaT, 2)) 
  
        last.x = current.x 
        last.y = current.y 
         
        dxDrawText(string.format("%.2f", timerMouseSpeedUpdt*180), 828, 182, 948, 217, tocolor(157, 3, 0, 255), 2.00, "pricedown", "left") -- increase the number to 180 because the number is too small! 
    end 
) 
setTimer(function() timerMouseSpeedUpdt = mouseSpeed end, 150, 0) 

Run Client-Side and press F8 to show mouse (It does not work by pressing " T " key)

Although if it works, has various problems.

1. It does not work if the cursor is hidden (obvious since "getCursorPosition" does not return the position of the cursor being hidden)

2. if you reach the edge of the screen to stop the speed of the mouse (can not be calculated because it does not change the cursor position :D )

My initial idea was to take the same mouse speed, natively, so (being the hidden cursor, or at the edge of the screen) work.

Really sorry for taking away their time, and I hope your answers. :wink:

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...