- 149
- 12
lua:
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand('runtopoint', function()
runToPoint(-846.95587158203, 1213.2403564453)
end)
while true do
wait(0)
end
end
function runToPoint(tox, toy)
local x, y, z = getCharCoordinates(PLAYER_PED)
local angle = getHeadingFromVector2d(tox - x, toy - y)
setCameraPositionUnfixed(0, math.rad(angle - 90))
stopRun = false
while not stopRun and getDistanceBetweenCoords2d(x, y, tox, toy) > 0.8 do
setGameKeyState(1, -255)
setGameKeyState(16, 1)
wait(0)
x, y, z = getCharCoordinates(PLAYER_PED)
angle = getHeadingFromVector2d(tox - x, toy - y)
setCameraPositionUnfixed(0, math.rad(angle - 90))
end
end