-- https://www.blast.hk/threads/13892/post-1317607
runToPoint = lua_thread.create_suspended(function(tox, toy) -- use: runToPoint:run(x, y)
local x, y, z = getCharCoordinates(PLAYER_PED)
local angle = getHeadingFromVector2d(tox - x, toy - y)
local xAngle = math.random(-50, 50)/100
setCameraPositionUnfixed(xAngle, math.rad(angle - 90))
stopRun = false
while getDistanceBetweenCoords2d(x, y, tox, toy) > 0.8 do
setGameKeyState(1, -255)
wait(1)
x, y, z = getCharCoordinates(PLAYER_PED)
angle = getHeadingFromVector2d(tox - x, toy - y)
setCameraPositionUnfixed(xAngle, math.rad(angle - 90))
if stopRun then
stopRun = false
break
end
end
end)