addEventHandler ("onPlayerVehicleEnter", getRootElement(), function (theVehicle, seat, jacked)
if theVehicle and seat == 0 then
theVehicle:setData("lastPos", theVehicle:getPosition())
end
end)
setTimer(function()
for k, veh in ipairs(getElementsByType("vehicle")) do
if veh then
local pos = veh:getPosition()
local vec = veh:getData("lastPos")
if pos and vec and distance then
--[[ Error => ]] local value = getDistanceBetweenPoints3D(vec:getX(), vec:getY(), vec:getZ(), pos:getX(), pos:getY(), pos:getZ())
if value then
-------------
end
end
end
end
end, 2000, 0)
attempt to index local "vec" ( a user data value )