for k,v in pairs(coords) do
if isCharInAnyCar(PLAYER_PED) then
local car = storeCarCharIsInNoSave(PLAYER_PED)
local carPosX, carPosY, carPosZ = getCarCoordinates(car)
local posX, posY, sprintOrSpeed = v.x, v.y, v.speed
repeat
wait(0)
draw_line(posX, posY)
turning_mechanism(tonumber(posX), tonumber(posY), carPosX, carPosY, car)
if getCarSpeed(car) < sprintOrSpeed + 4.0 then
local x1, y1, z1 = getOffsetFromCarInWorldCoords(car, 0, 5.0, 0) -- Перед
local x2, y2, z2 = getOffsetFromCarInWorldCoords(car, 0, -5.0, 0) -- Зад
if math.floor(getDistanceBetweenCoords3d(x1, y1, z1, posX, posY, carPosZ)) < math.floor(getDistanceBetweenCoords3d(x2, y2, z2, posX, posY, carPosZ)) then
writeMemory(0xB73458 + 0x20, 1, 255, false) -- Вперед
else
writeMemory(0xB73458 + 0x21, 1, 255, false) -- Назад
end
else
writeMemory(0xB73458 + 0xC, 1, 255, false) -- Стоп
end
until locateCharOnFoot2d(PLAYER_PED, tonumber(posX), tonumber(posY), 5.0, 5.0, false) or locateCharInCar2d(PLAYER_PED, tonumber(posX), tonumber(posY), 5.0, 5.0, false)
else
break
end
end