Try that:
local spawnPoints = {
{416, 2066.1, 1396, 10.9, 0, 0, 127},
{416, -678.5, 977.4, 12.1, 0, 0, 127},
}
local supplyVehicle = false
local supplyVehicle_blip = false
local supplyCollecter = false
local safeZone = false
function enterToSupplyVehicle(player, seat)
if seat == 0 then
outputChatBox("You have collected the supplies! Get to the safezone!", player, 0, 255, 0)
supplyCollecter = player
safeZone = createMarker(-687.2, 956.5, 12.1, "corona", 4, 255, 0, 255, 255, player)
addEventHandler("onMarkerHit", safeZone, hitSafeZoneMarker)
addEventHandler("onVehicleStartExit", supplyVehicle, exitFromSupplyVehicle)
end
end
function exitFromSupplyVehicle(player)
outputChatBox("Woah :O you need dem supplies! Get da :O back in da car hoe.", player, 0, 255, 0)
resetAll()
end
function hitSafeZoneMarker(player)
outputChatBox("Supplies have been delivered. New supplies spawn in 5 minutes.", root, 0, 255, 0)
resetAll()
setTimer(createDrops, 300000, 1)
end
function resetAll()
removeEventHandler("onVehicleEnter", supplyVehicle, enterToSupplyVehicle)
removeEventHandler("onVehicleStartExit", supplyVehicle, exitFromSupplyVehicle)
removeEventHandler("onMarkerHit", safeZone, hitSafeZoneMarker)
destroyElement(safeZone)
destroyElement(supplyVehicle_blip)
destroyElement(supplyVehicle)
supplyCollecter = false
end
function createDrops()
if not isElement(supplyVehicle) then
local randomPoint = math.random(1, #spawnPoints)
supplyVehicle = createVehicle(spawnPoints[randomPoint][1], spawnPoints[randomPoint][2], spawnPoints[randomPoint][3], spawnPoints[randomPoint][4], spawnPoints[randomPoint][5], spawnPoints[randomPoint][6], spawnPoints[randomPoint][7])
supplyVehicle_blip = createBlipAttachedTo(supplyVehicle, 0)
outputChatBox("Supply Drop Spawned! Go capture it and return it to the safezone.", root, 0, 255, 0)
addEventHandler("onVehicleEnter", supplyVehicle, enterToSupplyVehicle)
end
end
createDrops()