mybool = false
function spawntruck (truckElement)
if ( isElement(truckElement) and getElementType(truckElement) == 'player' ) then
if mybool == true then
destroyElement(TruckVehiclesTable[truckElement])
end
local truckVeh = getPedOccupiedVehicle(truckElement)
mybool = true
local x, y, z = getElementPosition (truckElement)
local rotX, rotY, rotZ = getElementRotation (truckElement)
TruckVehiclesTable[truckElement] = createVehicle (515, x-5, y, z+2)
setElementRotation (TruckVehiclesTable[truckElement], rotX, rotY, 90)
warpPedIntoVehicle (truckElement, TruckVehiclesTable[truckElement])
delivmark = createMarker(-1355.6999511719, -506.20001220703, 13.10000038147, "cylinder", 3, 42, 214, 153, 100) --this is the location.
deliverBlip = createBlipAttachedTo ( delivmark, 52 ) --the blip I want on the destination marker.
setBlipSize ( myBlip, 1 )
outputChatBox ("You have took on the role of goods courier, deliver the goods to the dollar blip to get your reward", truckElement, 0, 255, 0)
outputChatBox ("Do NOT leave the vehicle or it will be destroyed and your mission will fail!", truckElement, 255, 0, 0)
end
end
addEventHandler("onMarkerHit", startdelmark, spawntruck)
make sure to set mybool to false when you destroy it .