local vector3d = require("vector3d") -- для удобства
function getVectorAngles(v) -- возвращает углы вектора
local f = math.atan2(v.y, v.x)
local t = math.acos(v.z / v:length())
return f + (f > 0 and -1 or 1) * math.pi, math.pi / 2 - t
end
local from = vector3d(0, 0, 0) -- точка старта
local to = vector3d(100, 100, 100) -- точка назначения
local step = 5 -- шаг телепорта
-- где-то в цикле
local o = to - from
local f, t = getVectorAngles(o) -- получаем угол к точке назначения, относительно текущего вектора
-- получаем координаты следующей точки с шагом
local x = from.x + step * math.sin(t - math.pi / 2) * math.cos(f)
local y = from.y + step * math.sin(t - math.pi / 2) * math.sin(f)
local z = from.z + step * math.cos(t - math.pi / 2)
-- телепортируемся и обновляем координаты
setCharCoordinates(PLAYER_PED, x, y, z)
from.x, from.y, from.z = x, y, z
wait(1000) -- задержка между шагами