server:
-- By Al3grab
tCars = {}
tCan = {}
function onjoin ()
tCan[source] = nil
end
addEventHandler("onPlayerJoin",root,onjoin)
marcker1ofGive = createMarker (-3584.5581054688,-3007.271484375,60.200000762939, "cylinder", 4.5, 0, 0, 255, 320 )
function MarkerHit(thePlayer, source)
if tCan[thePlayer] ~= true then
if not isPedInVehicle(thePlayer) then
x,y,z = getElementPosition( thePlayer )
tCars[thePlayer] = createVehicle ( 411, x,y,z )
warpPedIntoVehicle(thePlayer,tCars[thePlayer])
tCan[thePlayer] = true
end
end
end
addEventHandler( "onMarkerHit", marcker1ofGive, MarkerHit )
function onquit ()
if tCars[source] then
if isElement(tCars[source]) then
destroyElement(tCars[source])
end
end
tCan[source] = nil
end
addEventHandler("onPlayerQuit",root,onquit)
function destroyIt()
setTimer(function(car)
for k,v in ipairs ( tCars ) do
if v == car then
tCars[k] = nil
tCan[k] = nil
end
end
destroyElement(car)
end , 2000 , 1 ,source,controller)
end
addEventHandler("onVehicleExplode",root,destroyIt)