local Vector3D = require('vector3d');
local points = {
Vector3D(1, 1, 1),
Vector3D(2, 2, 1),
Vector3D(3, 3, 1),
Vector3D(4, 4, 1),
};
local currentPoint;
-- start
currentPoint = 0;
-- loop
if (currentPoint) then
local pos = Vector3D(getCarCoordinates(storeCarCharIsInNoSave(PLAYER_PED)));
local currentPointPos = points[currentPoint];
local dist = getDistanceBetweenCoords3d(pos.x, pos.y, pos.z, currentPointPos.x, currentPointPos.y, currentPointPos.z);
if (dist <= 4) then
currentPoint = currentPoint + 1;
if (currentPoint > #points) then
currentPoint = nil;
print('Done!');
else
print('Point passed, next');
taskCarDriveToCoord(...);
end
end
end