DarkRP:Vehicles

From Official DarkRP Wiki
Jump to: navigation, search
This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | Russia-flag.png Русский | France-flag.png Français

You can add vehicles for certain jobs to sell.
You can do this at the bottom of lua/darkrp_customthings/vehicles.lua (see here).

How to add your own:

First, install your custom vehicle pack (if you're using one), then go in-game and type rp_getvehicles. It should print a list of available vehicles into your console. Choose the vehicle you would like to add, find its corresponding rp_getvehicles name, and keep it somewhere safe for the next step.

DarkRP.createVehicle({
	name = Name_of_vehicle,
	model = model,
	price = price,
	allowed = Jobs_that_can_buy_it, -- Optional
	customCheck = customcheck, -- Optional
	label = Label_to_show_in_F4_menu, -- Optional, will use name if not set
        distance = 85, -- Optional, an offset distance, use when the vehicles are really big and spawn inside the player
        angle = Angle(0, 0, 0), -- Optional, an offset angle
        onBought = function(ply, vehicleTbl, ent) end, -- Optional, function that is called when the vehicle is bought
})

How to find the model:

- If it's a custom vehicle, find the addons folder where the vehicle is and look in the /models folder, you want the name of the .mdl file for the vehicle you want.

- If it's a custom vehicle, go in-game and go into the q menu and the browse section, click on "Garry's Mod" and see if the vehicle appears there, if so right click and click 'Copy path to clipboard', then paste it in your code. If it doesn't appear when you click "Garry's Mod", try the subfolders until you find it.

- If it's a default vehicle, like the jeep or the jalopy, you can usually find their models by searching in the q menu in-game, however they're listed here too:

   "models/buggy.mdl" = Half Life 2 Jeep
   "models/airboat.mdl" = Half Life 2 Airboat
   "models/vehicle.mdl" = Half Life 2: Episode 2 Car

Here's an example:

DarkRP.createVehicle({
	name = "Airboat",
	model = "models/airboat.mdl",
	price = 600,
	allowed = {TEAM_MEDIC, TEAM_GUN}
})

In this example it allows TEAM_MEDIC and TEAM_GUN to buy an airboat for $600.


Another example:

DarkRP.createVehicle({
    name = "Bus",
    model = "models/borderlands/bus/bus.mdl",
    price = 3500,
    angle = Angle(0, 90, 0),
    distance = 200
})

The SCARS bus is really big and spawns inside of the player if you don't watch out. This is solved by rotating it 90 degrees and allowing it to be spawned further away.