Darkrp server crashing on changing job !

Hi Facepunch community,

I got a darkrp server on Nfoserver, everything is working, but the problem is that when someone change his job, it sometimes make my server simply crash. It’s pretty random, and can happen everytimes. My jobs are in jobsrelated.lua
It mostly crash when someone change to a police job, like swat,sas, etc.

If someone could help me, pls.


Here is my jobrelated.lua :

– People often copy jobs. When they do, the GM table does not exist anymore.
– This line makes the job code work both inside and outside of gamemode files.
– You should not copy this line into your code.
local GAMEMODE = GAMEMODE or GM
/--------------------------------------------------------
Default teams. Please do not edit this file. Please use the darkrpmod addon instead.
--------------------------------------------------------
/
TEAM_CITIZEN = DarkRP.createJob(“Citoyen”, {
color = Color(20, 150, 20, 255),
model = {
“models/player/Group01/Female_01.mdl”,
“models/player/Group01/Female_02.mdl”,
“models/player/Group01/Female_03.mdl”,
“models/player/Group01/Female_04.mdl”,
“models/player/Group01/Female_06.mdl”,
“models/player/group01/male_01.mdl”,
“models/player/Group01/Male_02.mdl”,
“models/player/Group01/male_03.mdl”,
“models/player/Group01/Male_04.mdl”,
“models/player/Group01/Male_05.mdl”,
“models/player/Group01/Male_06.mdl”,
“models/player/Group01/Male_07.mdl”,
“models/player/Group01/Male_08.mdl”,
“models/player/Group01/Male_09.mdl”
},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “citizen”,
max = 0,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false,
candemote = false
})

TEAM_POLICE = DarkRP.createJob(“Policier”, {
color = Color(25, 25, 170, 255),
model = {
“models/player/uk_police/uk_police_01.mdl”,
“models/player/uk_police/uk_police_02.mdl”,
“models/player/uk_police/uk_police_03.mdl”,
“models/player/uk_police/uk_police_04.mdl”,
“models/player/uk_police/uk_police_05.mdl”,
“models/player/uk_police/uk_police_06.mdl”,
“models/player/uk_police/uk_police_07.mdl”,
“models/player/uk_police/uk_police_08.mdl”,
“models/player/uk_police/uk_police_09.mdl”,
},
description = [],
weapons = {“arrest_stick”, “unarrest_stick”, “fas2_glock20”, “stunstick”, “door_ram”, “weaponchecker”, “weapon_arc_atmcard”, “handcuffs”},
command = “police”,
max = 4,
salary = GAMEMODE.Config.normalsalary * 1.45,
admin = 0,
vote = false,
hasLicense = true,
ammo = {
[“pistol”] = 60,
}
})

TEAM_GANG = DarkRP.createJob(“Gangster”, {
color = Color(75, 75, 75, 255),
model = {
“models/player/Group03/Female_01.mdl”,
“models/player/Group03/Female_02.mdl”,
“models/player/Group03/Female_03.mdl”,
“models/player/Group03/Female_04.mdl”,
“models/player/Group03/Female_06.mdl”,
“models/player/group03/male_01.mdl”,
“models/player/Group03/Male_02.mdl”,
“models/player/Group03/male_03.mdl”,
“models/player/Group03/Male_04.mdl”,
“models/player/Group03/Male_05.mdl”,
“models/player/Group03/Male_06.mdl”,
“models/player/Group03/Male_07.mdl”,
“models/player/Group03/Male_08.mdl”,
“models/player/Group03/Male_09.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”,“keypad_cracker”,“lockpick”},
command = “gangster”,
max = 5,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false
})

TEAM_MOB = DarkRP.createJob(“Chef des Gangsters”, {
color = Color(25, 25, 25, 255),
model = “models/player/gman_high.mdl”,
description = [],
weapons = {“lockpick”, “unarrest_stick”,“weapon_arc_atmcard”, “keypad_cracker”},
command = “mobboss”,
max = 2,
salary = GAMEMODE.Config.normalsalary * 1.34,
admin = 0,
vote = false,
hasLicense = false

})

TEAM_SAMOURAI = DarkRP.createJob(“Samourai”, {
color = Color(25, 25, 25, 255),
model = “models/blacklist/merc1.mdl”,
description = [],
weapons = {“fas2_machete”, “weapon_arc_atmcard”},
command = “samourai”,
max = 2,
salary = 70,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_GUN = DarkRP.createJob(“Dealer d’armes”, {
color = Color(255, 140, 0, 255),
model = “models/player/monk.mdl”,
description = [],
weapons = {“weapon_arc_atmcard”},
command = “gundealer”,
max = 2,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false

})

TEAM_MEDIC = DarkRP.createJob(“Medecin”, {
color = Color(47, 79, 79, 255),
model = “models/player/kleiner.mdl”,
description = [],
weapons = {“med_kit”, “weapon_arc_atmcard”},
command = “medic”,
max = 3,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false,
medic = true

})

TEAM_CHIEF = DarkRP.createJob(“Chef de police”, {
color = Color(0,55,255),
model = “models/player/combine_soldier_prisonguard.mdl”,
description = [],
weapons = {“arrest_stick”, “unarrest_stick”, “fas2_deagle”, “stunstick”, “door_ram”, “weaponchecker”, “weapon_arc_atmcard”, “handcuffs”},
command = “chief”,
max = 1,
salary = GAMEMODE.Config.normalsalary * 1.67,
admin = 0,
vote = false,
hasLicense = true,
chief = true,
NeedToChangeFrom = TEAM_POLICE,
ammo = {
[“pistol”] = 60,
}
})

TEAM_MAYOR = DarkRP.createJob(“Maire”, {
color = Color(150, 20, 20, 255),
model = “models/player/breen.mdl”,
description = [],
weapons = {“fas2_p226”, “weapon_arc_atmcard”},
command = “mayor”,
max = 1,
salary = 200,
admin = 0,
vote = true,
hasLicense = false,
mayor = true

})

TEAM_HOBO = DarkRP.createJob(“Clochard”, {
color = Color(80, 45, 0, 255),
model = “models/player/corpse1.mdl”,
description = [],
weapons = {“weapon_bugbait”},
command = “hobo”,
max = 5,
salary = 0,
admin = 0,
vote = false,
hasLicense = false,
candemote = false,
hobo = true
})

TEAM_ADMIN = DarkRP.createJob(“Administrateur”, {
color = Color(25, 25, 170, 255),
model = “models/player/anon/anon.mdl”,“models/weapons/arms/anon_arms.mdl”,
description = [[Admin]],
weapons = {“weapon_arc_atmcard”},
command = “aod”,
max = 2,
salary = 1,
admin = 1,
vote = false,
hasLicense = true

})

TEAM_MOD = AddExtraTeam(“Moderateur”, {
color = Color(25, 25, 170, 255),
model = “models/player/leet.mdl”,
description = [],
weapons = {“weapon_arc_atmcard”},
command = “mod”,
max = 4,
salary = 1,
admin = 0,
vote = false,
hasLicense = false,
customCheck = function(ply) return CLIENT or
table.HasValue({“superadmin”, “modapp”, “mod”}, ply:GetNWString(“usergroup”))
end,
CustomCheckFailMsg = “Vous devez avoir le rank Moderateur pour choisir ce job !”,

})

TEAM_POLICE = AddExtraTeam(“S.A.S”, {
color = Color(0,55,255),
model = “models/player/gasmask.mdl”,
description = [],
weapons = {“arrest_stick”, “unarrest_stick”, “fas2_mp5sd6”, “stunstick”, “door_ram”, “weaponchecker”, “weapon_arc_atmcard”, “fas2_glock20”, “handcuffs”},
command = “sas”,
max = 2,
salary = 85,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_POLICE = AddExtraTeam(“S.A.S Medecin”, {
color = Color(0,55,255),
model = “models/player/gasmask.mdl”,
description = [],
weapons = {“arrest_stick”, “unarrest_stick”, “fas2_mp5sd6”, “stunstick”, “door_ram”, “weaponchecker”, “weapon_arc_atmcard”, “fas2_glock20”, “handcuffs”, “fas2_ifak”},
command = “sasmedecin”,
max = 1,
salary = 85,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_POLICE = DarkRP.createJob(“S.A.S LEADER”, {
color = Color(0,55,255),
model = {“models/player/riot.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “arrest_stick”, “unarrest_stick”, “stunstick” , “weaponchecker” , “door_ram” , “fas2_m4a1” , “fas2_mp5sd6”, “fas2_glock20”, “handcuffs”},
command = “sasleader”,
max = 1,
salary = 100,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_POLICE = DarkRP.createJob(“S.W.A.T”, {
color = Color(25, 25, 170, 255),
model = {“models/player/swat.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “arrest_stick”, “unarrest_stick”, “stunstick” , “weaponchecker” , “door_ram” , “fas2_m4a1”, “fas2_deagle”, “fas2_dv2”},
command = “swat”,
max = 2,
salary = 120,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_POLICE = DarkRP.createJob(“S.W.A.T Sniper”, {
color = Color(25, 25, 170, 255),
model = {“models/player/swat.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “arrest_stick”, “unarrest_stick”, “stunstick” , “weaponchecker” , “door_ram” , “fas2_m82”, “fas2_deagle”, “fas2_dv2”},
command = “swatsniper”,
max = 2,
salary = 120,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_POLICE = DarkRP.createJob(“S.W.A.T Medecin”, {
color = Color(25, 25, 170, 255),
model = {“models/player/swat.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “arrest_stick”, “unarrest_stick”, “stunstick” , “weaponchecker” , “door_ram” , “fas2_m4a1”, “fas2_deagle”, “fas2_dv2”, “fas2_ifak”},
command = “swatmedecin”,
max = 2,
salary = 120,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_POLICE = DarkRP.createJob(“S.W.A.T Leader”, {
color = Color(25, 25, 170, 255),
model = {“models/player/urban.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “arrest_stick”, “unarrest_stick”, “stunstick” , “weaponchecker” , “door_ram” , “fas2_m4a1”, “fas2_deagle”, “mfas2_m3s90”, “fas2_dv2”},
command = “swatleader”,
max = 1,
salary = 150,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_BANK = AddExtraTeam(“Banquier”, {
color = Color(20, 150, 20, 255),
model = {“models/player/Group01/male_02.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “banquier”,
max = 2,
salary = 100,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_MAFIEUX = DarkRP.createJob(“Mafieux”, {
color = Color(75, 75, 75, 255),
model = {“models/fearless/mafia09.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “keypad_cracker” ,“lockpick”},
command = “mafieux”,
max = 5,
salary = 80,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_POLICE = AddExtraTeam(“Sniper elite”, {
color = Color(0,55,255),
model = “models/fearless/sru01.mdl”,
description = [],
weapons = {“weapon_arc_atmcard”, “fas2_sr25”},
command = “sniperelite”,
max = 1,
salary = 100,
admin = 0,
vote = false,
hasLicense = true,

})

TEAM_PARRAIN = DarkRP.createJob(“Parrain”, {
color = Color(75, 75, 75, 255),
model = {“models/fearless/don1.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “keypad_cracker”, “lockpick”},
command = “parrain”,
max = 1,
salary = 110,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_SPY = DarkRP.createJob(“Espion”, {
color = Color(0, 0, 0, 255),
model = {“models/blacklist/spy1.mdl”},
description = [],
weapons = {“lockpick”, “weapon_arc_atmcard”},
command = “Spy”,
max = 2,
salary = 75,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_BROADCAST = DarkRP.createJob(“Journaliste”, {
color = Color(150, 20, 20, 255),
model = {“models/taggart/gallahan.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “journaliste”,
max = 2,
salary = 120,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_CHANTEUR = DarkRP.createJob(“Chanteur”, {
color = Color(150, 20, 20, 255),
model = {“models/player/Group01/Female_01.mdl”,“models/player/group01/male_01.mdl”,},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “chanteur”,
max = 3,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false,
candemote = false
})

TEAM_BLACKMARKETDEALER = DarkRP.createJob(“Vendeur d’arme illegal”, {
color = Color(255, 140, 0, 255),
model = {“models/player/eli.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “blackmarketdealer”,
max = 3,
salary = 60,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_MERCENAIRE = DarkRP.createJob(“Mercenaire”, {
color = Color(0, 0, 0, 255),
model = {“models/fearless/cr.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “mercenaire”,
max = 3,
salary = 45,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_TAXI = DarkRP.createJob(“Chauffeur de taxi”, {
color = Color(255, 140, 0, 255),
model = {“models/player/Group01/Female_01.mdl”,“models/player/group01/male_01.mdl”,},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “chauffeur”,
max = 5,
salary = GAMEMODE.Config.normalsalary,
admin = 0,
vote = false,
hasLicense = false,
candemote = false
})

TEAM_RUNNER = DarkRP.createJob(“Voleur”, {
color = Color(80,95,72),
model = {“models/player/phoenix.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”, “climb_swep2” ,“gm_pickpocket”, “lockpick”, “keypad_cracker”},
command = “voleur”,
max = 2,
salary = 65,
admin = 0,
vote = false,
hasLicense = false,

})

TEAM_PUTE = DarkRP.createJob(“Prostituee”, {
color = Color(150, 20, 20, 255),
model = {“models/fearless/rosa.mdl”},
description = [],
weapons = {“weapon_arc_atmcard”},
command = “proptituee”,
max = 4,
salary = 40,
admin = 0,
vote = false,
hasLicense = false,

})

– Compatibility for when default teams are disabled
TEAM_CITIZEN = TEAM_CITIZEN or -1
TEAM_POLICE = TEAM_POLICE or -1
TEAM_GANG = TEAM_GANG or -1
TEAM_MOB = TEAM_MOB or -1
TEAM_GUN = TEAM_GUN or -1
TEAM_MEDIC = TEAM_MEDIC or -1
TEAM_CHIEF = TEAM_CHIEF or -1
TEAM_MAYOR = TEAM_MAYOR or -1
TEAM_HOBO = TEAM_HOBO or -1

/*

HOW TO MAKE A DOOR GROUP

AddDoorGroup(“Cops and Mayor only”, TEAM_CHIEF, TEAM_POLICE, TEAM_MAYOR)

AddDoorGroup(“Gundealer only”, TEAM_GUN)

The default door groups, can also be used as examples:
*/
AddDoorGroup(“Cops and Mayor only”, TEAM_CHIEF, TEAM_POLICE, TEAM_MAYOR, TEAM_SWAT)
AddDoorGroup(“Gundealer only”, TEAM_GUN)

/*

HOW TO MAKE AN AGENDA

AddAgenda(Title of the agenda, Manager (who edits it), Listeners (the ones who just see and follow the agenda))

The default agenda’s, can also be used as examples:
*/
AddAgenda(“Gangster’s agenda”, TEAM_MOB, {TEAM_GANG})
AddAgenda(“Police agenda”, TEAM_MAYOR, {TEAM_CHIEF, TEAM_POLICE})

/*

HOW TO MAKE A GROUP CHAT

Pick one!
GAMEMODE:AddGroupChat(List of team variables separated by comma)

or

GAMEMODE:AddGroupChat(a function with ply as argument that returns whether a random player is in one chat group)
This one is for people who know how to script Lua.

*/
GAMEMODE:AddGroupChat(function(ply) return ply:isCP() end)
GAMEMODE:AddGroupChat(TEAM_MOB, TEAM_GANG)

/---------------------------------------------------------------------------
Define which team joining players spawn into and what team you change to if demoted
---------------------------------------------------------------------------
/
GAMEMODE.DefaultTeam = TEAM_CITIZEN

/---------------------------------------------------------------------------
Define which teams belong to civil protection
Civil protection can set warrants, make people wanted and do some other police related things
---------------------------------------------------------------------------
/
GAMEMODE.CivilProtection = {
[TEAM_POLICE] = true,
[TEAM_CHIEF] = true,
[TEAM_MAYOR] = true,
}

/---------------------------------------------------------------------------
Enable hitman goodies on this team
---------------------------------------------------------------------------
/

/---------------------------------------------------------------------------
Default demote groups
---------------------------------------------------------------------------
/
DarkRP.createDemoteGroup(“Cops”, {TEAM_POLICE, TEAM_CHIEF})
DarkRP.createDemoteGroup(“Gangsters”, {TEAM_GANG, TEAM_MOB})

I think this is your problem:
“Default teams. Please do not edit this file. Please use the darkrpmod addon instead.”

You can get the addon here: https://github.com/FPtje/darkrpmodification