Custom jobs for DarkRP won't work

Ok so, i where going to add some custom jobs but… didn´t seem to turn out that good :confused:

well, here is the code, plz check it out and plz tell me if there is something that is wrong… (rather WHAT is wrong)



RPExtraTeams = {}
function AddExtraTeam( Name, color, model, Description, Weapons, command, maximum_amount_of_this_class, Salary, admin, Vote, Haslicense, NeedToChangeFrom)
	if not Name or not color or not model or not Description or not Weapons or not command or not maximum_amount_of_this_class or not Salary or not admin or Vote == nil then
		local text = "One of the custom teams is wrongly made! Attempt to give name of the wrongly made team!(if it's nil then I failed):
" .. tostring(Name)
		print(text)
		hook.Add("PlayerSpawn", "TeamError", function(ply)
			if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text) end
		end)	
	end
	local CustomTeam = {name = Name, model = model, Des = Description, Weapons = Weapons, command = command, max = maximum_amount_of_this_class, salary = Salary, admin = admin or 0, Vote = tobool(Vote), NeedToChangeFrom = NeedToChangeFrom, Haslicense = Haslicense}
	table.insert(RPExtraTeams, CustomTeam)
	team.SetUp(#RPExtraTeams, Name, color)
	local Team = #RPExtraTeams
	if SERVER then
		timer.Simple(0.1, function(CustomTeam) AddTeamCommands(CustomTeam) end, CustomTeam)
	end
	return Team
end

hook.Add("InitPostEntity", "AddTeams", function()
	if file.Exists("CustomTeams.txt") then
		RunString(file.Read("CustomTeams.txt"))
		if SERVER then resource.AddFile("data/CustomTeams.txt") end
		if CLIENT and not LocalPlayer():IsSuperAdmin() then file.Delete("CustomTeams.txt") end
	end
end)

/*--------------------------------------------------------
Default teams. If you make a team above the citizen team, people will spawn with that team!
--------------------------------------------------------*/
TEAM_CITIZEN = AddExtraTeam("Citizen", Color(20, 150, 20, 255), "models/player/group01/male_01.mdl", [[The Citizen is the most basic level of society you can be
. 
You have no specific role in city life.]], {}, "citizen", 0, 45, 0, false, false)

TEAM_POLICE = AddExtraTeam("Civil Protection", Color(25, 25, 170, 255), "models/player/police.mdl", [[The protector of every citizen that lives in the city . 
You have the power to arrest criminals and protect innocents. 
Hit them with your arrest baton to put them in jail
Bash them with a stunstick and they might learn better than to disobey 
the law.
The Battering Ram can break down the door of a criminal with a warrant 
for his/her arrest.
The Battering Ram can also unfreeze frozen props(if enabled).
Type /wanted <name> to alert the public to this criminal
OR go to tab and warrant someone by clicking the warrant button]], {"arrest_stick", "unarrest_stick", "weapon_glock2", "stunstick", "door_ram", "weaponchecker", "item_ammo_pistol"}, "cp", 4, 65, 0, true, true)

TEAM_GANG = AddExtraTeam("Gangster", Color(75, 75, 75, 255), "models/player/group03/male_01.mdl", [[The lowest person of crime. 
A gangster generally works for the Mobboss who runs the crime family. 
The Mobboss sets your agenda and you follow it or you might be punished.]], {}, "gangster", 3, 45, 0, false, false)

TEAM_MOB = AddExtraTeam("Mob boss", Color(25, 25, 25, 255), "models/player/gman_high.mdl", [[The Mobboss is the crimboss in the city. 
With his power he coordinates the gangsters and forms an efficent crime
organization. 
He has the ability to break into houses by using a lockpick. 
The Mobboss also can unarrest you.]], {"lockpick", "unarrest_stick"}, "mobboss", 1, 60, 0, false, false)

TEAM_GUN = AddExtraTeam("Gun Dealer", Color(255, 140, 0, 255), "models/player/monk.mdl", [[A gun dealer is the only person who can sell guns to other 
people. 
However, make sure you aren't caught selling guns that are illegal to 
the public.
/Buyshipment <name> to Buy a  weapon shipment
/Buygunlab to Buy a gunlab that spawns P228 pistols]], {}, "gundealer", 2, 45, 0, false, false)

TEAM_MEDIC = AddExtraTeam("Medic", Color(47, 79, 79, 255), "models/player/kleiner.mdl", [[With your medical knowledge, you heal players to proper 
health. 
Without a medic, people can not be healed. 
Left click with the Medical Kit to heal other players.
Right click with the Medical Kit to heal yourself.]], {"med_kit"}, "medic", 3, 45, 0, false, false)

TEAM_COOK = AddExtraTeam("Cook", Color(238, 99, 99, 255), "models/player/mossman.mdl", [[As a cook, it is your responsibility to feed the other members 
of your city. 
You can spawn a microwave and sell the food you make:
/Buymicrowave]], {}, "cook", 2, 45, 0, 0, false)

TEAM_CHIEF = AddExtraTeam("Civil Protection Chief", Color(20, 20, 255, 255), "models/player/combine_soldier_prisonguard.mdl", [[The Chief is the leader of the Civil Protection unit. 
Coordinate the police forces to bring law to the city
Hit them with arrest baton to put them in jail
Bash them with a stunstick and they might learn better than to 
disobey the law.
The Battering Ram can break down the door of a criminal with a 
warrant for his/her arrest.
Type /wanted <name> to alert the public to this criminal
Type /jailpos to set the Jail Position]], {"arrest_stick", "unarrest_stick", "weapon_deagle2", "stunstick", "door_ram", "weaponchecker", "item_ammo_pistol"}, "chief", 1, 75, 0, false, true, TEAM_POLICE)

TEAM_MAYOR = AddExtraTeam("Mayor", Color(150, 20, 20, 255), "models/player/breen.mdl", [[The Mayor of the city creates laws to serve the greater good 
of the people.
If you are the mayor you may create and accept warrants.
Type /wanted <name>  to warrant a player
Type /jailpos to set the Jail Position
Type /lockdown initiate a lockdown of the city. 
Everyone must be inside during a lockdown. 
The cops patrol the area
/unlockdown to end a lockdown]], {"item_ammo_pistol"}, "mayor", 1, 85, 0, true, false/*, {TEAM_CHIEF, TEAM_POLICE}*/)
/*
--------------------------------------------------------
HOW TO MAKE AN EXTRA CLASS!!!!
--------------------------------------------------------

You can make extra classes here. Set everything up here and the rest will be done for you! no more editing 100 files without knowing what you're doing!!!
Ok here's how:

To make an extra class do this:
AddExtraTeam( "<NAME OF THE CLASS>", Color(<red>, <Green>, <blue>, 255), "<Player model>" , [[<the description(it can have enters)>]], { "<first extra weapon>","<second extra weapon>", etc...}, "<chat command to become it(WITHOUT THE /!)>", <maximum amount of this team> <the salary he gets>, 0/1/2 = public /admin only / superadmin only, <1/0/true/false Do you have to vote to become it>,  true/false DOES THIS TEAM HAVE A GUN LICENSE?, TEAM: Which team you need to be to become this team)

The real example is here: it's the Hobo:		*/

--VAR without /!!!			The name    the color(what you see in tab)                   the player model					The description
TEAM_HOBO = AddExtraTeam("Hobo", Color(80, 45, 0, 255), "models/player/corpse1.mdl", [[The lowest member of society. All people see you laugh. 
You have no home.
Beg for your food and money
Sing for everyone who passes to get money
Make your own wooden home somewhere in a corner or 
outside someone else's door]], {"weapon_bugbait"}, "hobo", 5, 0, 0, false)
//No extra weapons           say /hobo to become hobo  Maximum hobo's = 5		his salary = 0 because hobo's don't earn money.          0 = everyone can become hobo ,      false = you don't have to vote to become hobo
// MAKE SURE THAT THERE IS NO / IN THE TEAM NAME OR IN THE TEAM COMMAND:
// TEAM_/DUDE IS WROOOOOONG !!!!!!
// HAVING "/dude" IN THE COMMAND FIELD IS WROOOOOOOONG!!!!
//ADD TEAMS UNDER THIS LINE:






TEAM_terrorist = AddExtraTeam("terrorist", Color(34, 78, 80, 255), "models/player/leet.mdl", [[You are a terrorist now go kill someone but whatch out for cops !!!]], {"weapon_p2282"}, "terrorist", 3, 10, 0, true)//



TEAM_robber = AddExtraTeam("Robber", Color(0,122,59,255), "models/player/phoenix.mdl", [[Rob money and guns.]], {"weapon_deagle2"}, "robber", 6, 20, 0, true)//


TEAM_secretservice = AddExtraTeam("Secret Service", Color(225,127,0,255), "models/player/Group01/male_07.mdl", [[You are with the police.]], {"lockpick"}, "secretservice", 6, 30, 0, true)//


TEAM_rebel = AddExtraTeam("Rebel", Color(102,51,51,255), "models/player/guerilla.mdl", [[you are on the bad side :P]], {}, "rebel", 15, 20, 0, false)//


TEAM_rebelleader = AddExtraTeam("Rebel Leader", Color(102,51,102,255), "models/player/guerilla.mdl", [[You are the leader of the Rebels.]], {}, "rebelleader", 1, 30, 0, false)//



TEAM_sas = AddExtraTeam("sas", Color(34,34,83,255),"models/player/gasmask.mdl", [[be a secret group and make plans.....dont let them find you]], {"weapon_glock2","weapon_mp52","door_ram","stunstick","unarrest_stick","arrest_stick","talk"}, "sas", 3, 30, 0, true)
//


TEAM_sasLeader = AddExtraTeam("sasLeader", Color(60,23,75,255),"models/player/gasmask.mdl", [[Lead the secret group, make sure you dont get caught and make the plans]], {"weapon_deagle2","weapon_pumpshotgun2","door_ram","stunstick","unarrest_stick","talk","arrest_stick"}, "sasleader", 3, 40, 0, true)
//


TEAM_assassin = AddExtraTeam("assassin", Color(60,23,75,255),"models/player/Phoenix.mdl", [[assassinate some people, make sure your not caught!!!!]], {"assassins_Knife","talk"}, "assassin", 2, 30, 1, false)
//



TEAM_Security_guy = AddExtraTeam("Security_guy", Color(250,0,155,255),"models/player/group01/Male_04.mdl", [[be a security guard, maybe help guard the gundealers? maybe even guard the mayor>]], {"weapon_glock2","talk"}, "Security_guy", 1, 30, 0, false)
//


TEAM_drug = AddExtraTeam("Drug dealer", Color(0,102,0,255), "models/player/t_arctic.mdl", [[Sell drugz!!!
]], {"talk", "weapon_p2282"}, "drug", 3, 30, 0, false)
//


TEAM_BANKER = AddExtraTeam("Banker", Color(102,0,102,255), "models/player/eli.mdl", [[Bankers are people storing stuff for other.
 They cant take deposited items for themself!]], {}, "banker", 3, 50, 0, false, false)
//

TEAM_admin = AddExtraTeam("admin", Color(153,0,255,255), "models/player/magnusson.mdl", [[You are a admin, help the players!
]], {"weapon_real_cs_admin_weapon"}, "admin", 50, 75, 1, )
//



oh, and here is the code for custom shipements (if now something would be wrong with them…)



CustomVehicles = {}
CustomShipments = {}
ShipmentWeaponClasses = {} --Global since it's used for custom shipments.
function AddCustomShipment(name, model, entity, price, Amount_of_guns_in_one_shipment, Sold_seperately, price_seperately, noshipment, classes, shipmodel)
	if not name or not model or not entity or not price or not Amount_of_guns_in_one_shipment or (Sold_seperately and not price_seperately) then
		local text = "One of the custom shipments is wrongly made! Attempt to give name of the wrongly made shipment!(if it's nil then I failed):
" .. tostring(name)
		print(text)
		hook.Add("PlayerSpawn", "ShipmentError", function(ply)
			if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text) end end)		
		return
	end
	if not util.IsValidModel(model) then
		local text = "The model of shipment "..name.." is incorrect! can not create custom shipment!"
		print(text) 
		hook.Add("PlayerSpawn", "ShipmentError", function(ply)
			if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text) end end)		
		return
	end
	local AllowedClasses = classes or {}
	if not classes then
		for k,v in pairs(team.GetAllTeams()) do
			table.insert(AllowedClasses, k)
		end
	end
	local price = tonumber(price)
	local shipmentmodel = shipmodel or "models/Items/item_item_crate.mdl"
	table.insert(CustomShipments, {name = name, model = model, entity = entity, price = price, weight = 5, amount = Amount_of_guns_in_one_shipment, seperate = Sold_seperately, pricesep = price_seperately, noship = noshipment, allowed = AllowedClasses, shipmodel = shipmentmodel})
	ShipmentWeaponClasses[name] = {}
	ShipmentWeaponClasses[name][entity] = model
end

function AddCustomVehicle(Name_of_vehicle, price, Jobs_that_can_buy_it)
	local function warn(add)
		local text
		if Name_of_vehicle then text = Name_of_vehicle end
		text = text.." FAILURE IN CUSTOM VEHICLE!"
		print(text)
		hook.Add("PlayerSpawn", "VehicleError", function(ply)
			if ply:IsAdmin() then ply:ChatPrint("WARNING: "..text.." "..add) end end)		
	end
	if not Name_of_vehicle or not price then
		warn("The name or the price is invalid/missing")
		return
	end
	local found = false
	for k,v in pairs(list.Get("Vehicles")) do
		if string.lower(k) == string.lower(Name_of_vehicle) then found = true break end
	end
	if not found then
		warn("vehicle not found!")
		return
	end
	table.insert(CustomVehicles, {name = Name_of_vehicle, price = price, allowed = Jobs_that_can_buy_it})
end

hook.Add("InitPostEntity", "AddShipments", function()
	if file.Exists("CustomShipments.txt") then
		timer.Simple(2, RunString, file.Read("CustomShipments.txt"))
		if SERVER then resource.AddFile("data/CustomShipments.txt") end
		if CLIENT and not LocalPlayer():IsSuperAdmin() then file.Delete("CustomShipments.txt") end
	end
end)

/*
How to add custom vehicles:
FIRST
go ingame, type rp_getvehicles for available vehicles!
then:
AddCustomVehicle(<One of the vehicles from the rp_getvehicles list>, <Price of the vehicle>, <OPTIONAL jobs that can buy the vehicle>)
Examples:
AddCustomVehicle("Jeep", 100)
AddCustomVehicle("Airboat", 600, {TEAM_GUN})
AddCustomVehicle("Airboat", 600, {TEAM_GUN, TEAM_MEDIC})

Add those lines under your custom shipments. At the bottom of this file or in data/CustomShipments.txt

HOW TO ADD CUSTOM SHIPMENTS:
AddCustomShipment("<Name of the shipment(no spaces)>"," <the model that the shipment spawns(should be the world model...)>", "<the classname of the weapon>", <the price of one shipment>, <how many guns there are in one shipment>, <OPTIONAL: true/false sold seperately>, <OPTIONAL: price when sold seperately>, < true/false OPTIONAL: /buy only = true> , OPTIONAL which classes can buy the shipment, OPTIONAL: the model of the shipment)

Notes:
MODEL: you can go to Q and then props tab at the top left then search for w_ and you can find all world models of the weapons!
CLASSNAME OF THE WEAPON
there are half-life 2 weapons you can add:
weapon_pistol
weapon_smg1
weapon_ar2
weapon_rpg
weapon_crowbar
weapon_physgun
weapon_357
weapon_crossbow
weapon_slam
weapon_bugbait
weapon_frag
weapon_physcannon
weapon_shotgun
gmod_tool

But you can also add the classnames of Lua weapons by going into the weapons/ folder and look at the name of the folder of the weapon you want.
Like the player possessor swep in addons/Player Possessor/lua/weapons You see a folder called weapon_posessor 
This means the classname is weapon_posessor

YOU CAN ADD ITEMS/ENTITIES TOO! but to actually make the entity you have to press E on the thing that the shipment spawned, BUT THAT'S OK!
YOU CAN MAKE GUNDEALERS ABLE TO SELL MEDKITS!

true/false: Can the weapon be sold seperately?(with /buy name) if you want yes then say true else say no

the price of sold seperate is the price it is when you do /buy name. Of course you only have to fill this in when sold seperate is true.


EXAMPLES OF CUSTOM SHIPMENTS(remove the // to activate it): */

//AddCustomShipment("HL2pistol", "models/weapons/W_pistol.mdl", "weapon_pistol", 500, 10, false, 200, false, {TEAM_GUN, TEAM_MEDIC})

--EXAMPLE OF AN ENTITY(in this case a medkit)
--AddCustomShipment("bball", "models/Combine_Helicopter/helicopter_bomb01.mdl", "sent_ball", 100, 10, false, 10, false, {TEAM_GUN}, "models/props_c17/oildrum001_explosive.mdl")
--EXAMPLE OF A BOUNCY BALL:   		NOTE THAT YOU HAVE TO PRESS E REALLY QUICKLY ON THE BOMB OR YOU'LL EAT THE BALL LOL
--AddCustomShipment("bball", "models/Combine_Helicopter/helicopter_bomb01.mdl", "sent_ball", 100, 10, true, 10, true)
-- ADD CUSTOM SHIPMENTS HERE(next line):

 

AddCustomShipment("Acid", "models/smile/smile.mdl", "durgz_lsd", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})

AddCustomShipment("Alcohol", "models/drug_mod/alcohol_can.mdl", "durgz_alcohol", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})

AddCustomShipment("asprin", "models/jaanus/aspbtl.mdl", "durgz_aspirin", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})

AddCustomShipment("cigarette", "models/boxopencigshib.mdl", "durgz_cigarette", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})

AddCustomShipment("cocaine", "models/cocn.mdl", "durgz_cocaine", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})

AddCustomShipment("heroine", "models/katharsmodels/syringe_out/syringe_out.mdl", "durgz_heroine", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})
A

AddCustomShipment("weed", "models/katharsmodels/contraband/zak_wiet/zak_wiet.mdl", "durgz_weed", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})
A

AddCustomShipment("shrooms", "models/ipha/mushroom_small.mdl", "durgz_mushroom", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})

AddCustomShipment("water_bottle", "models/drug_mod/the_bottle_of_water.mdl", "durgz_water", 1000, 10, false, 0, false, {TEAM_drug, TEAM_admin})
 
AddCustomShipment("RPG", "models/weapons/w_rocket_launcher.mdl", "weapon_RPG", 5000, 10, false, 0, false, {TEAM_admin})

AddCustomShipment("LockPick", "models/weapons/w_crowbar.mdl", "lockpick", 4000, 10, true, 425, false, {TEAM_MOB})

AddCustomShipment("unarrest_stick", "models/weapons/w_stunbaton.mdl", "unarrest_stick", 750, 10, true, 80, false, {TEAM_MOB, TEAM_GANG})

AddCustomShipment("keypad_cracker", "models/weapons/w_c4.mdl", "keypad_cracker", 0, 0, true, 400, true, {TEAM_MOB, TEAM_GANG, "TEAM_admin"})

AddCustomShipment("M249", "models/weapons/w_mach_m249para.mdl", "weapon_real_cs_m249", 6000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("Galil", "models/weapons/w_rif_galil.mdl", "weapon_real_cs_galil", 4000, 10, false, 0, false, {TEAM_GUN})


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


AddCustomShipment("M4A1", "models/weapons/w_rif_m4a1.mdl", "weapon_real_cs_m4a1", 400, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("Famas", "models/weapons/w_rif_famas.mdl", "weapon_real_cs_famas", 4000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("AWP", "models/weapons/w_snip_awp.mdl", "weapon_real_cs_awp", 7000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("Scout", "models/weapons/w_snip_scout.mdl", "weapon_real_cs_scout", 4500, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("SteyrAug", "models/weapons/w_rif_aug.mdl", "weapon_real_cs_aug", 4000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("SG552", "models/weapons/w_rif_sg552.mdl", "weapon_real_cs_sg552", 4000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("G3SG1", "models/weapons/w_snip_g3sg1.mdl", "weapon_real_cs_g3sg1", 4000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("SG550", "models/weapons/w_snip_sg550.mdl", "weapon_real_cs_sg550", 4000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("UMP45", "models/weapons/w_smg_ump45.mdl", "weapon_real_cs_ump_45", 3700, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("P90", "models/weapons/w_smg_p90.mdl", "weapon_real_cs_p90", 3500, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("TMP", "models/weapons/w_smg_tmp.mdl", "weapon_real_cs_tmp", 3500, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("MP5", "models/weapons/w_smg_mp5.mdl", "weapon_real_cs_mp5a5", 3200, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("Mac10", "models/weapons/w_smg_mac10.mdl", "weapon_real_cs_mac10", 3000, 10, false, 0, false, {TEAM_GUN})


AddCustomShipment("Shotgun", "models/weapons/w_shot_m3super90.mdl", "weapon_real_cs_pumpshotgun", 2500, 10, false, 0, false, {TEAM_GUN})

AddCustomShipment("Grenade", "models/weapons/w_eq_fraggrenade.mdl", "weapon_real_cs_grenade", 15000, 10, false, 0, false, {TEAM_admin})

AddCustomShipment("Flash", "models/weapons/w_eq_flashbang_thrown.mdl", "weapon_real_cs_flash", 2000, 10, false, 0, false, {TEAM_admin})

AddCustomShipment("Smoke", "models/weapons/w_eq_smokegrenade.mdl", "weapon_real_cs_smoke", 2000, 10, false, 0, false, {TEAM_admin})

AddCustomShipment("DualElites", "models/weapons/w_pist_elite_dropped.mdl", "weapon_real_cs_elites", 2300, 10, true, 250, false, {TEAM_GUN})

AddCustomShipment("Deagle", "models/weapons/w_pist_deagle.mdl", "weapon_real_cs_desert_eagle", 2300, 10, true, 250, false, {TEAM_GUN})

AddCustomShipment("USP", "models/weapons/w_pist_usp.mdl", "weapon_real_cs_usp", 2200, 10, true, 240, false, {TEAM_GUN})

AddCustomShipment("P228", "models/weapons/w_pist_p228.mdl", "weapon_real_cs_p228", 2000, 10, true, 220, false, {TEAM_GUN})


AddCustomShipment("FiveSeven", "models/weapons/w_pist_fiveseven.mdl", "weapon_real_cs_five-seven", 2000, 10, true, 200, false, {TEAM_GUN})


AddCustomShipment("Knife", "models/weapons/w_knife_t.mdl", "weapon_real_cs_knife", 1500, 10, false, 0, false, {TEAM_GUN})


                                                  Hope someone can help me, thx!

For custom jobs aren’t you suppose to do something like “TEAM_DRUG” For Drug Dealer, etc? Not lowercase?

Gonna try that… thx

Fixed!