SA:MP прерывистое движение

Condition

Новичок
Автор темы
18
6
взял какой то старый код для скрипта на передвижение, а он после каждой координаты останавливается на секунду, с некоторыми другими функциями такая же проблема
код:
local stat = false
local coords = {
   {1956, 1340},
   {1958, 1344},
   {1957, 1349},
   {1957, 1353},
   {1962, 1355},
   {1972, 1357},
   {1973, 1353},
   {1977, 1356},
   {1981, 1357},
   {1983, 1355}
}
local poin = 1


function runToPoint(tox, toy)
    local x, y, z = getCharCoordinates(PLAYER_PED)
    local angle = getHeadingFromVector2d(tox - x, toy - y)
    local xAngle = 0
    setCameraPositionUnfixed(xAngle, math.rad(angle - 90))

    while getDistanceBetweenCoords2d(x, y, tox, toy) > 0.8 do
        setGameKeyState(1, -255)
        wait(10)
        x, y, z = getCharCoordinates(PLAYER_PED)
        angle = getHeadingFromVector2d(tox - x, toy - y)
        setCameraPositionUnfixed(xAngle, math.rad(angle - 90))
    end
    setGameKeyState(1, 0)
end

function main()
    sampRegisterChatCommand('zvm', function()
        stat = not stat
        sampAddChatMessage(stat and 'ZVB enabled' or 'ZVB disabled', -1)
    end)

    while true do
        wait(0)
        if stat then
            local tox = coords[poin][1]
            local toy = coords[poin][2]
            runToPoint(tox, toy)

            -
            poin = poin + 1
            if poin > #coords then
                poin = 1
            end

            wait(500)
        end
    end
end