Garry's Mod

Garry's Mod

43 ratings
DarkRP Basic Scripting Guide (OUTDATED 2013)
By WalkDownCody600
A basic walkthrough on modifications to your DarkRP server such as custom jobs, custom weapon/drugs shipments, how to make a job that sells cars and more.
   
Award
Favorite
Favorited
Unfavorite
Custom Jobs
How to make your own jobs

When I first started making jobs for DarkRP, I used a website called Deadeye's Classmaker.[deadeye.comule.com] All you have to do is fill in the blanks and the website generates a custom job for you. The next thing you do is copy and paste the script into your shared.lua and you're done! (but that comes later.)

Once you're done filling in the blanks you should have something that looks like this:

//Created using DeaDeye's Classmaker
TEAM_THIEF = AddExtraTeam("Thief", Color(153, 102, 0, 255), "models/player/eli.mdl", [[Thief steals things.]], {"weapon_real_cs_knife"}, "thief", 5, 40, 0, false, false, false)

I reccomend taking away the first line since it's unneccesary. So:

TEAM_THIEF = AddExtraTeam("Thief", Color(153, 102, 0, 255), "models/player/eli.mdl", [[Thief steals things.]], {"weapon_real_cs_knife"}, "thief", 5, 40, 0, false, false, false)

Once you make this you go to your server's file manager (via FTP/any browser the provider gives you) and follow this path:

orangebox>garrysmod>gamemodes>darkrp>gamemode> then edit the shared.lua.
THIS IS THE SHARED.LUA FILE. DO NOT TAMPER WITH THE SHARED FOLDER.

Once you get to this, scroll down near the bottom where it says:
"//ADD CUSTOM TEAMS UNDER THIS LINE:"

Once you get here, paste 'er in on the line below. I like to leave a couple lines after the script for the next one, just in case.

REMEMBER: Always leave a line between each custom job you put in. This prevents .lua errors.

Once that's pasted in, save the file and try out your new thief class!
Custom Entities (Shipments/Cars)
How to make certain jobs able to buy added entities. (DurgzMod, CS:S, TDM Cars)

Custom Weapons

First of all, follow this path in your file manager/FTP:
orangebox>garrysmod>gamemodes>darkrp>gamemode and edit the addentities.lua file.
Scroll down to the bottom where it shows you "-- ADD CUSTOM SHIPMENTS HERE(next line):" and go to the next line.

Here, I will give you the script and you will fill in the blanks!

AddCustomShipment("<Entity Name>", "<model prop code>", "<code for weapon>", <price>, <amount inside shipment>, false, 0, false, {<team that can buy it>})

To find the <code for weapon> go to your Q menu and right click on the weapon you want to be put in. Select 'copy to clipboard' and copy that into the script, replacing '<code for weapon>'

For example, here is a script that allows the gun dealer to be able to sell a counterstrike AK47:

AddCustomShipment("AK47", "models/weapons/w_rif_ak47.mdl", "weapon_real_cs_ak47", 4000, 10, false, 0, false, {TEAM_GUN, TEAM_ADMIN})

If you want to be able to sell single weapons:

Change the script to this:

AddCustomShipment("<Entity Name>", "<model prop code>", "<code for weapon>", <price>, 10, true, <price again>, true, {<team that can buy it>})

For example, a single AK47:

AddCustomShipment("AK47", "models/weapons/w_rif_ak47.mdl", "weapon_real_cs_ak47", 400, 10, true, 400, true, {TEAM_GUN, TEAM_ADMIN})

Custom Car Sales

(This tutorial includes examples from TDM Cars[www.garrysmod.org])

Add your own version of this code under "-- ADD CUSTOM SHIPMENTS HERE(next line):" :

AddCustomVehicle("<vehicle display name>", "<vehicle model code>", <price>, {<teams allowed to sell the vehicle>})

For example, here is a code for the Medic and Gun Dealer to sell an airboat for $600:

AddCustomVehicle("Airboat", "models/airboat.mdl", 600, {TEAM_GUN, TEAM_MEDIC})

Custom Drug Shipments

(This tutorial includes examples from the Durgz Mod[www.garrysmod.org].)

Underneath "-- ADD CUSTOM SHIPMENTS HERE(next line):", copy and paste in your version of this script:

AddCustomShipment("<drug name>", "<model code>", "<item name in Qmenu>", <price>, <amount in a shipment>, false, 0,false, {<team allowed to buy>})

Here is an example using the Durgz Mod addon for weed:

AddCustomShipment("Weed", "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl", "durgz_weed", 7000, 10, false, 0,false, {TEAM_DRUGDEALER})

All of these, copy and pasted in, should work fine. If not look at the spacing between codes and make sure any errors are fixed. Thank you!
Giving Custom Jobs Their Own Agendas
How to add an agenda for one of your own jobs.

First go to /orangebox/garrysmod/gamemodes/darkrp/gamemode/ in your file manager/FTP.

Edit the shared.lua file and scroll to the very bottom. You will see two agendas all ready there:

AddAgenda("Gangster's agenda", TEAM_MOB, {TEAM_GANG})
AddAgenda("Police agenda", TEAM_MAYOR, {TEAM_CHIEF, TEAM_POLICE})

To add your own, make another line and type:

AddAgenda("<agenda name>", <agenda creator>, {<teams who can see the agenda})

For example, here is an agenda set up for a group of outlaws:

AddAgenda("Outlaw agenda", TEAM_OUTLAWCHIEF, {TEAM_OUTLAW})

If you want to add a S.W.A.T. class to the police agenda:

Simply change
AddAgenda("Police agenda", TEAM_MAYOR, {TEAM_CHIEF, TEAM_POLICE})
to
AddAgenda("Police agenda", TEAM_MAYOR, {TEAM_CHIEF, TEAM_POLICE},TEAM_SWAT)
or what ever team name you set to your class.

And there you have it!
48 Comments
WalkDownCody600  [author] 23 Nov, 2015 @ 3:25pm 
@Hackcraft this is outdated af, consider the post date (JANUARY 2013)
EggPoweredLawnMowerOnLSD 17 Aug, 2014 @ 4:43pm 
what if i want to make a job for one steam id AND superadmins only ? any ideas
AWPocalipse 11 Jun, 2014 @ 9:30am 
I cant add custom shipments i cant get the model place ( Example: models/weapons/w_rif_ak47.mdl)
Samurai Town 2 Apr, 2014 @ 7:08pm 
Pyro, here's mine.
GAMEMODE.CivilProtection = {
[TEAM_POLICE] = true,
[TEAM_CHIEF] = true,
[TEAM_MAYOR] = true,
[TEAM_SUPERADMIN] = true,
[TEAM_ADMIN] = true,
[TEAM_SWAT] = true
}
Crippled memes 13 Feb, 2014 @ 5:35am 
The example for cars is not with TDM cars
Lux 25 Oct, 2013 @ 10:29pm 
This is cool and all, but I can't get DeadEye's Class Maker to load...
PeaceKeeper [JJT] 12 Sep, 2013 @ 3:38pm 
This is the perfect Basic Script Guide you could get. Can't get any easier to explain than how he did. Thumbs up!
cocking balls 25 Aug, 2013 @ 3:01pm 
Nice tutorial. Do you know how to make it so that a SWAT unit can do stuff a police can, like make someone wanted? Thanks!
KioneWinterHowl 8 Aug, 2013 @ 11:53am 
For some odd reason when Im cp on my server and I try to want someone it says you need to be a member of the police force
76561198060011560 17 Jul, 2013 @ 2:23am 
I find this really useful. Thanks!