Jump to content

Marker Vehicle


kewiiNNN

Recommended Posts

Posted

how to make a marker and when you go in the marker it will spawn you any random cars in fast cars in f1 create section? and when the vehicle its empty it will be destroyed like vanish in 2 min

Posted
  
  
  
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

Posted

you need to replace

carmarker = createMarker( x,y,z, "cylinder", 2, 255, 255, 255, 210, root )

from x,y,z to your coordinates

and also

car = createVehicle( carid, x,y,z )

x,y,z to the coordinates where the car should spawn

Posted

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) 

Posted
  
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) 
  

Posted

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) 
  

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...