Difference between revisions of "DarkRP:Vehicles"

From Official DarkRP Wiki
Jump to navigation Jump to search
(New syntax.)
(How to add your own:)
Line 16: Line 16:
 
customCheck = customcheck -- Optional
 
customCheck = customcheck -- Optional
 
label = Label_to_show_in_F4_menu -- Optional, will use name if not set
 
label = Label_to_show_in_F4_menu -- Optional, will use name if not set
 +
        offset = Vector(0, 0, 0) -- Optional, an offset position
 +
        angle  = Angle(0, 0, 0) -- Optional, an offset angle
 
})
 
})
 
}}
 
}}

Revision as of 22:57, 29 January 2015

This page is available in the following languages:
Данная версия страницы доступна на следующих языках:
Jarvis-flag 8010.png English | Russia-flag.png Русский


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
        offset = Vector(0, 0, 0) -- Optional, an offset position
        angle  = Angle(0, 0, 0) -- Optional, an offset angle
})

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.