Jump to content

Arrow pointing at the cursor


FuriouZ

Recommended Posts

  
showCursor(true) 
  
local sx, sy = guiGetScreenSize() 
angle = 0 
addEventHandler("onClientRender", root, 
    function() 
        --showCursor(true) 
        local x, y = getCursorPosition() 
        angle = findRotation(x*sx, y*sy, 358, 276) 
        outputChatBox(angle) 
        dxDrawImage(358, 100, 100, 100, ":CUPvehicles/files/lock.png", 0, 0, 0, tocolor(255, 255, 255, 255), false) 
        dxDrawImage(140, 276, 100, 100, ":CUPvehicles/files/engine.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(537, 276, 100, 100, ":CUPvehicles/files/lights.png", 0, 0, 0, tocolor(255, 255, 255, 255), true) 
        dxDrawImage(358, 276, 100, 100, ":CUPvehicles/files/switch.png",  angle, 0, 0, tocolor(255, 255, 255, 255), true) 
    end 
) 
  
function findRotation( x1, y1, x2, y2 ) 
    local t = -math.deg( math.atan2( x2 - x1, y2 - y1 ) ) 
    return t < 0 and t + 360 or t 
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...