Tried doing this with no luck. Is there some minor tweaks needed?
function getVehicleByPlate ( logInDetails )
for _, vehicle in ipairs (getElementsByType ("vehicle")) do
if getVehiclePlateText ( vehicle ) == logInDetails then
found = vehicle
local x, y, z = getElementPosition(source)
local vx, vy, vz = getElementPosition(found)
if getDistanceBetweenPoints2D(x, y, vx, vy) < 420 then
createBlipAttachedTo(found, 0, 4, 255, 0, 0, 255, 0, 100, source)
outputChatBox("Plate registered and found, destination marked on GPS", 255, 0, 0, true)
end
break
end
return found
end
end