Hi I Hope I Can Help You
--== Script By ErroR (FullOffeD) ==--
-- Set the target position
local targetX, targetY, targetZ = 100, 200, 10
-- Create the vehicle
local vehicle = createVehicle(411, 0, 0, 0)
-- Get Distance
function getDistance(x1, y1, z1, x2, y2, z2)
return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2)
end
function moveVehicleToTarget()
local x, y, z = getElementPosition(vehicle)
local distance = getDistance(x, y, z, targetX, targetY, targetZ)
-- Speed To Move
local speed = 5
if distance > 1 then
local directionX = (targetX - x) / distance
local directionY = (targetY - y) / distance
local directionZ = (targetZ - z) / distance
setElementPosition(vehicle, x + directionX * speed, y + directionY * speed, z + directionZ * speed)
addEventHandler("onClientRender", root, moveVehicleToTarget)
else
removeEventHandler("onClientRender", root, moveVehicleToTarget)
end
end
Use Thats Code To Move Vehicle To Your Custom x,y,z Without Player