deliveryLocations = {
{275, 1956, 17}, -- LV Military Forces HQ Base
{-1303, 473, 7}, -- SF Naval Ship Base
}
rhinoLocations = {
--LV
{-685, 1195, 14},
{2542, 2853, 10},
--SF
{-1742, 2445, 70},
{-1950, -1083, 30},
{-2071, -2437, 30},
--LS
{2264, -2539, 8},
{679, -443, 16},
}
function generateAV()
local x, y, z = unpack(rhinoLocations[math.random(#rhinoLocations)])
avRhino = createVehicle(432, x, y, z+0.5)
blip = createBlipAttachedTo(avRhino, 19)
function onPlayerEnterTheAV(pla)
local team = getPlayerTeam(pla)
local teamName = getTeamName(team)
if (teamName == "Criminals" or teamName == "Police" or teamName == "Military Forces" or teamName == "SWAT") then
addEventHandler("onVehicleEnter", avRhino, generateDeliveryLocation)
elseif (teamName ~= "Criminals" or teamName ~= "Police" or teamName ~= "Military Forces" or teamName ~= "SWAT") then
outputChatBox("You cannot access this vehicle.", pla, 255, 0, 0)
cancelEvent()
end
end
addEventHandler("onVehicleStartEnter", avRhino, onPlayerEnterTheAV)
end
setTimer(generateAV, 5000, 1)
function generateDeliveryLocation(pla)
local x, y, z = unpack(deliveryLocations[math.random(#deliveryLocations)])
deliveryMarker = createMarker(x, y, z-1, "cylinder", 8, 255, 255, 0)
locationBlip = createBlipAttachedTo(deliveryMarker, 19)
rhinoDisarm = getPedOccupiedVehicle(pla)
toggleControl("vehicle_fire", false)
addEventHandler("onMarkerHit", deliveryMarker, generateRhinoPaymentMarker)
end
function generateRhinoPaymentMarker(pla)
if (not isPedInVehicle(pla)) then return end
rhino = getPedOccupiedVehicle(pla)
x, y, z = getElementPosition(rhino)
paymentMarker = createMarker(x + 1, y, z, 1, 255, 255, 0)
setElementFrozen(rhino, true)
addEventHandler("onMarkerHit", paymentMarker, payDeliveryService)
end
function payDeliveryService(pla)
if (isPedInVehicle(pla)) then return end
local team = getPlayerTeam(pla)
local teamName = getTeamName(team)
if (teamName ~= "Criminals" or teamName ~= "Police" or teamName ~= "Military Forces" or teamName ~= "SWAT") then return end
outputChatBox("The NGC Law headquarters have decided to pay you for the service of protecting the lost Rhino! Grab your stash of money near the vehicle", pla, 255, 100, 194)
givePlayerMoney(pla, 20000)
destroyElement(paymentMarker)
end
^ I don't know why I'm getting this.