Jump to content

random vehicles


meh

Recommended Posts

Guest Guest4401

Hello, use this serverside code in your map.

local randomPickup_vehicleID = 513 -- this is the stuntplane's vehicleID. when you place a stuntplane vehiclechange pickup, then it will give you a random vehicle instead of stuntplane. if not stuntplane, write some other vehicleID here 
local randomVehicleIDS = { 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503 } -- these are the random vehicle ids. when you hit the random vehicle pickup, it gives you one of these vehicles. 
  
addEvent("onPlayerPickUpRacePickup", true) 
addEventHandler("onPlayerPickUpRacePickup", getRootElement(), 
    function(pickupID, pickupType, vehicleModel) 
        if pickupType == "vehiclechange" and vehicleModel == randomPickup_vehicleID then 
            setElementModel(getPedOccupiedVehicle(source), randomVehicleIDS[math.random(1, #randomVehicleIDS)]) 
        end 
    end 
) 

You have to place a 'stuntplane' vehiclechange Race pickup in your map. When a player hits that pickup, then instead of getting stuntplane he'll get a random vehicle. Check the first two lines of the code.

I've only added street racers cars to the random vehicle list, you can add more in 2nd line of code

To know what vehicleIDs are, https://wiki.multitheftauto.com/wiki/Vehicle_IDs

EDIT : Actually you can do the same by creating a marker also, by using setElementModel in onClientMarkerHit event.

Link to comment
Hello, use this serverside code in your map.
local randomPickup_vehicleID = 513 -- this is the stuntplane's vehicleID. when you place a stuntplane vehiclechange pickup, then it will give you a random vehicle instead of stuntplane. if not stuntplane, write some other vehicleID here 
local randomVehicleIDS = { 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503 } -- these are the random vehicle ids. when you hit the random vehicle pickup, it gives you one of these vehicles. 
  
addEvent("onPlayerPickUpRacePickup", true) 
addEventHandler("onPlayerPickUpRacePickup", getRootElement(), 
    function(pickupID, pickupType, vehicleModel) 
        if pickupType == "vehiclechange" and vehicleModel == randomPickup_vehicleID then 
            setElementModel(getPedOccupiedVehicle(source), randomVehicleIDS[math.random(1, #randomVehicleIDS)]) 
        end 
    end 
) 

You have to place a 'stuntplane' vehiclechange Race pickup in your map. When a player hits that pickup, then instead of getting stuntplane he'll get a random vehicle. Check the first two lines of the code.

I've only added street racers cars to the random vehicle list, you can add more in 2nd line of code

To know what vehicleIDs are, https://wiki.multitheftauto.com/wiki/Vehicle_IDs

EDIT : Actually you can do the same by creating a marker also, by using setElementModel in onClientMarkerHit event.

omg, man, thank you for your hard work, i don't even know how to thank you. :D

Link to comment
  • 2 weeks later...

In that video, it's not about random vehicles. It just changes your vehicle when you drive through a checkpoint. If that's what you mean, here's an explanation of how to do it:

You don't need a script. When you're in the map editor, in the topmenu go to EDF (Definitions) and add "Race". Then, at the bottom left, you position your mouse on the icons and scroll. The icons should change and after a few scrolls you should see the race-icons: pickup, spawnpoint and marker (I'm not sure what icons and in what order). When you place or select a checkpoint, you press F3 and a small menu-window will appear. In this window, you can set a vehiclemodel if I'm right (when you hit the checkpoint, your vehicle will be changed into the one set). Another option, is to create a pickup (map editor, bottom left menu icons, be sure it is a RACE pickup and not a normal pickup), select it, press F3, set 'type' to 'vehiclechange' and select a vehicle in the vehiclemodel space thingie.

Link to comment

thanx for the advice, but this won't do. if you watch those videos a few more times. you'll notice that (in the first vid) the same checkpoint gives different vehicles to players and (i the second vid) there're no checkpoints at all, since it's a dd map. and as we all know dd maps and checkpoints don't really work all that great together. so i need a script. and i got it already from karthik184. know i'm curious how to use it. he said i gotta use it in serverside code. what's that and how do i use it? ty 4 help.

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