From Official DarkRP Wiki
Revision as of 14:52, 2 April 2013 by FPtje (talk | contribs)
Jump to navigation Jump to search

Custom job fields

You can create custom jobs in DarkRP. However, there are many things to fiddle with. This page explains every single "field".

Example with all fields

Here's an example with all available fields filled in:

TEAM_Example = AddExtraTeam("Example team", {
	color = Color(255, 255, 255, 255),
	model = {
	description = [[This text will serve as the description of
		this team.]],
	weapons = {"weapon_p2282"},
	command = "example",
	max = 3,
	salary = 45,
	admin = 0,
	vote = false,
	hasLicense = false,
	NeedToChangeFrom = TEAM_CITIZEN,
	help = "You are an example. Walk around and be exemplary.",
	customCheck = function(ply) return ply.DarkRPVars.money > 10000 end,
	CustomCheckFailMsg = "You don't have enough money!",
	modelScale = 1.2,

	CanPlayerSuicide = function(ply) return false end,
	PlayerCanPickupWeapon = function(ply, weapon) return true end,
	PlayerDeath = function(ply, weapon, killer) end,
	PlayerLoadout = function(ply) return true end,
	PlayerSelectSpawn = function(ply, spawn) end,
	PlayerSetModel = function(ply) return "models/player/Group03/Female_02.mdl" end,
	PlayerSpawn = function(ply) end,
	PlayerSpawnProp = function(ply, model) end,
	ShowSpare1 = function(ply) end,
	ShowSpare2 = function(ply) end

Field explanations


The color of the team in tab and other places.


The model of the team. This can either be a string or a table of strings. Two examples: A string, players who have this job have ONE model, namely the one given in the string:

model = "models/player/Group03/Female_01.mdl"

A table, the model of the player holding this job is randomly chosen from the list of given models:

model = {


The description of a job shows up in the F4 menu when selecting the job. Describe what your job does and what the use of it is.


The list of weapons people with this job spawn with (besides the default weapons) The following example means that the job spawns with the weapons in the list:

weapons = {"arrest_stick", "unarrest_stick", "weapon_deagle2", "stunstick", "door_ram", "weaponchecker"


What do you have to enter in chat to get this job? example: type /example in chat to get the example job

command = "example"

Note: If the job requires voting, a command "/voteexample" is added.


How many people can have this job at any given time.


The salary this job gets.


What (admin) access you need to get this job.

admin = 0 -- anyone can get this job
admin = 1 -- only admins can get this job
admin = 2 -- only superadmins can get this job

If you want to customize this further (with donators, moderators and whatnot), look at customCheck (scroll down)


Do players need to create a vote to get this job? true for yes, false for no.


Does this job get a gun license for free? true for yes, false for no. It's useful to give the cops gun licenses.


You can only get this job if you had a specific other job first. Example: You can only become a chief of police when you're already a CP:

NeedToChangeFrom = TEAM_POLICE

Example 2: You can only become a mayor if you're either a CP or a chief



The help text that shows up for this job when the player opens the F1 help menu.


See http://wiki.darkrp.com/index.php/DarkRP-Config


Custom message when someone tries and fails to get the job. See http://wiki.darkrp.com/index.php/DarkRP-Config#Custom_fail_messages


How big are the players that have this job? 1 for the default size 1.2 for 120% of the default size 0.9 for 90% of the default size.

Don't make it too big or too small, people will get trouble with jumping and crouching.

More advanced fields


A function that decides whether players with this job can commit suicide. Arguments: Player ply


A function that decides whether players with this job can pick up a certain weapon Arguments: Player ply, Entity weapon


Called when a player dies Arguments: Player ply, Entity weapon, Entity killer


Called when a player gets his weapons. Return true to prevent him from getting his default weapons! Arguments: Player ply


Called when a spawn is selected for this player. Arguments: Player ply, Entity spawn


A function that decides what the model should be. ALWAYS return a model (string) if you implement this function. Arguments: Player ply


Called when a player spawns Arguments: Player ply


Called when a player attempts to spawn a prop Arguments: Player ply, string model


Called when a player presses the F1 key Arguments: Player ply


Called when a player presses the F2 key Arguments: Player ply