- 149
- 12
помогите как сделать что бы команда работала как вкл/выкл бега по координатам
Hui:
function main()
while not isSampAvailable() do wait(0) end
sampRegisterChatCommand('hui', function ()
lua_thread.create(function ()
runToPoint(100, 100)
end)
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)
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)
--setGameKeyState(16, 1)
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