markerPegar = createMarker(1221.0225830078, -1388.1735839844, 13.442749977112 -1, "cylinder", 1.5, 0,255,0,100)
markerDestruir = createMarker(1223.1115722656, -1388.1994628906, 13.435565948486 -1, "cylinder", 1.5, 255,0,0,100)
veh = {}
function pegarVeiculo (source)
for _, v in ipairs (getElementsByType("player")) do
if getPedOccupiedVehicle(v) then
return
end
if veh[source] and isElement(veh[source]) then
destroyElement(veh[source])
end
veh[source] = createVehicle(490, 1220.6763916016, -1398.3157958984, 13.185880661011)
warpPedIntoVehicle(source, veh[source])
end
end
addEventHandler("onMarkerHit", markerPegar, pegarVeiculo)
function dest (source)
if veh[source] and isElement(veh[source]) then
destroyElement (veh[source])
local name = getPlayerName(source)
end
end
addEventHandler("onMarkerHit", markerDestruir, dest)
function DestroyVeiculo ()
destroyElement (veh[source])
end
addEventHandler ("onPlayerQuit", root, DestroyVeiculo)