Jump to content

Marker Vehicle


kewiiNNN

Recommended Posts

  
  
  
local cars = { 
    {411}, 
    {410}, 
    {412} 
} 
  
carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root ) 
  
function carmarkerhit(hitElement) 
if(isElement(hitElement) and getElementType(hitElement) == "player")then 
randomcar = math.random(#cars) 
carid = cars[randomcar][1] 
car = createVehicle( carid, x,y,z ) 
warpPedintoVehicle( hitElement ) 
setTimer( function() 
destroyElement( car ) 
end, 120000, 1 
end 
end 
addEventHandler("onMarkerHit", carmarker, carmarkerhit ) 
  

didnt test if it works, you also have to replace the coordinates to your's

Link to comment

Fixed @BlueTheFurry's code:

local cars = { 
    {411}, 
    {410}, 
    {412} 
} 
  
carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root ) 
  
function carmarkerhit(hitElement) 
    if (isElement(hitElement) and getElementType(hitElement) == "player") then 
        randomcar = math.random(#cars) 
        carid = cars[randomcar][1] 
        car = createVehicle(carid, x,y,z) 
        warpPedintoVehicle(hitElement) 
        setTimer(function() 
            destroyElement(car) 
        end, 120000, 1) 
    end 
end 
addEventHandler("onMarkerHit", carmarker, carmarkerhit) 

Link to comment
  
local cars = { 
    {411}, 
    {410}, 
    {412} 
} 
  
carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root ) 
  
function carmarkerhit(hitElement) 
    if (isElement(hitElement) and getElementType(hitElement) == "player") then 
        randomcar = math.random(#cars) 
        carid = cars[randomcar][1] 
        car = createVehicle(carid, x,y,z) 
        warpPedIntoVehicle(hitElement,car) 
        setTimer(function() 
            destroyElement(car) 
        end, 120000, 1) 
    end 
end 
addEventHandler("onMarkerHit", carmarker, carmarkerhit) 
  

Link to comment

all working but is there a way to add so while you driving you cant spawn a new vehicle? only while walking

  
local cars = { 
    {429}, 
    {402}, 
    {541}, 
    {415}, 
    {480}, 
    {562}, 
    {587}, 
    {565}, 
    {411}, 
    {559}, 
    {603}, 
    {560}, 
    {506}, 
    {451}, 
    {558}, 
    {555}, 
    {477} 
} 
  
carmarker = createMarker( -1316.7326660156,-29.210359573364,13.2, "cylinder", 2, 255, 0, 0, 210, root ) 
  
function carmarkerhit(hitElement) 
    if (isElement(hitElement) and getElementType(hitElement) == "player") then 
        randomcar = math.random(#cars) 
        carid = cars[randomcar][1] 
        car = createVehicle(carid, -1329.3344726563,-37.078189849854,14.1484375) 
        warpPedIntoVehicle(hitElement,car) 
        setTimer(function() 
            destroyElement(car) 
        end, 120000, 1) 
    end 
end 
addEventHandler("onMarkerHit", carmarker, carmarkerhit) 
  

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...