Hi! I've been working on developing my own DarkRP server because I thought it could be a fun little side project to work on when I've got nothing else to do. I got around to creating custom jobs today, and when I started adding custom Civil Protection jobs, I ran into some trouble. The jobs themselves seem to work, however, when I try to add them under "GAMEMODE.CivilProtection", it starts throwing errors like such:
[ERROR] A runtime error has occurred in "addons/darkrpmodification-master/lua/darkrp_customthings/jobs.lua" on line 33.
The best help I can give you is this:
A table is being indexed by something that does not exist (table index is nil).
Hints:
- The thing between square brackets does not exist (is nil).
The responsibility for the error above lies with (the authors of) one (or more) of these files:
1. addons/darkrpmodification-master/lua/darkrp_customthings/jobs.lua on line 33
2. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84
3. gamemodes/darkrp/gamemode/libraries/fn.lua on line 84
4. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 137
5. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 148
6. gamemodes/darkrp/gamemode/init.lua on line 111
------- End of Simplerr error -------
1. error - [C]:-1
2. doInclude - gamemodes/darkrp/gamemode/libraries/simplerr.lua:530
3. loadCustomDarkRPItems - gamemodes/darkrp/gamemode/libraries/modificationloader.luCouldn't Load Init Script: 'darkrp/gamemode/init.lua'
I know for a fact that the "thing between square brackets" does exist, as The TEAM_NAME is exactly copied and pasted from where the job is created.
My jobs file is as follows:
--[[---------------------------------------------------------------------------
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,
[TEAM_SPECIALPOLICE] = true,
[TEAM_SPECIALMEDIC] = true,
[TEAM_SPECIALSNIPER] = true,
}
--[[---------------------------------------------------------------------------
Jobs that are hitmen (enables the hitman menu)
---------------------------------------------------------------------------]]
DarkRP.addHitmanTeam(TEAM_MOB)
--------------------------------------------------------------------------------
--Civillians
TEAM_MEDIC = DarkRP.createJob("Medic", {
color = Color(66, 134, 244, 255),
model = {
"models/player/kleiner.mdl"
},
description = [[You are a Medic. You sell your services to those in need.]],
weapons = {"med_kit"},
command = "medic",
max = 2,
salary = 100,
admin = 0,
vote = false,
candemote = false,
hasLicense = false,
category = "Citizens",
})
TEAM_HOBO = DarkRP.createJob("Hobo", {
color = Color(89, 66, 8, 255),
model = {
"models/player/corpse1.mdl"
},
description = [[You are homeless. You are the lowest member of society.]],
weapons = {"weapon_bugbait"},
command = "hobo",
max = 0,
salary = 0,
admin = 0,
vote = false,
candemote = false,
hasLicense = false,
hobo = true,
category = "Citizens",
})
TEAM_KING = DarkRP.createJob("Hobo King", {
color = Color(0, 0, 0, 255),
model = {
"models/player/corpse1.mdl"
},
description = [[You are the king of the homeless.]],
weapons = {"weapon_bugbait","m9k_knife"},
command = "models/player/charple.mdl",
max = 1,
salary = 0,
admin = 0,
vote = false,
candemote = false,
hasLicense = false,
hobo = true,
category = "Citizens",
customCheck = function(ply) return ply:GetUserGroup() == "donator" == "vip+" or ply:GetUserGroup() == "donator" == "vip" or ply:IsAdmin() end,
CustomCheckFailMsg = "You need to be VIP or above to access this job.",
})
--Government
TEAM_MAYOR = DarkRP.createJob("Mayor", {
color = Color(112, 0, 0, 255),
model = {
"models/player/breen.mdl",
},
description = [[You are the leader of our glorious city. Command your Civil Protection Agency in order to take control of the rampant crime in the downtown streets.]],
weapons = {"m9k_deagle"},
command = "mayor",
max = 1,
salary = 250,
admin = 0,
vote = true,
candemote = true,
mayor = true,
hasLicense = true,
category = "Government",
})
TEAM_POLICE = DarkRP.createJob("Police", {
color = Color(0, 43, 112, 255),
model = {
"models/humans/nypd1940/male_01.mdl",
"models/humans/nypd1940/male_02.mdl",
"models/humans/nypd1940/male_03.mdl",
"models/humans/nypd1940/male_04.mdl",
"models/humans/nypd1940/male_05.mdl",
"models/humans/nypd1940/male_06.mdl",
"models/humans/nypd1940/male_07.mdl",
"models/humans/nypd1940/male_08.mdl",
"models/humans/nypd1940/male_09.mdl",
},
description = [[You are a peace keeper. Use the tools at your disposal to keep the streets free from crime.]],
weapons = {"m9k_usp"},
command = "police",
max = 4,
salary = 150,
admin = 0,
vote = true,
candemote = true,
hasLicense = true,
category = "Government",
})
TEAM_CHIEF = DarkRP.createJob("Police Chief", {
color = Color(0, 43, 112, 255),
model = {
"models/humans/nypd1940/male_01.mdl",
"models/humans/nypd1940/male_02.mdl",
"models/humans/nypd1940/male_03.mdl",
"models/humans/nypd1940/male_04.mdl",
"models/humans/nypd1940/male_05.mdl",
"models/humans/nypd1940/male_06.mdl",
"models/humans/nypd1940/male_07.mdl",
"models/humans/nypd1940/male_08.mdl",
"models/humans/nypd1940/male_09.mdl",
},
description = [[You are the chief of our boys in blue. Use the tools at your disposal to keep the streets free from crime.]],
weapons = {"m9k_deagle"},
command = "Chief",
max = 1,
salary = 200,
admin = 0,
vote = true,
candemote = true,
chief = true,
hasLicense = true,
category = "Government",
})
TEAM_SPECIALPOLICE = DarkRP.createJob("SWAT", {
color = Color(0, 43, 112, 255),
model = {
"models/omgwtfbbq/quantum_break/characters/operators/monarchoperator01playermodel.mdl",
},
description = [[You are part of the tactical branch of the Civil Protection. Use the tools at your disposal to keep the streets free from crime.]],
weapons = {"m9k_usp","m9k_m4a1"},
command = "swat",
max = 2,
salary = 200,
admin = 0,
vote = true,
candemote = true,
hasLicense = true,
PlayerLoadout = function(ply)
ply:SetHealth(100)
ply:SetArmor(100)
end,
category = "Government",
})
TEAM_SPECIALMEDIC = DarkRP.createJob("SWAT Medic", {
color = Color(0, 43, 112, 255),
model = {
"models/omgwtfbbq/quantum_break/characters/operators/monarchoperator01playermodel.mdl",
},
description = [[You are part of the tactical branch of the Civil Protection. Use the tools at your disposal to keep the streets free from crime.]],
weapons = {"m9k_usp","m9k_m4a1","med_kit"},
command = "swatmedic",
max = 2,
salary = 200,
admin = 0,
vote = true,
candemote = true,
hasLicense = true,
PlayerLoadout = function(ply)
ply:SetHealth(100)
ply:SetArmor(100)
end,
category = "Government",
})
TEAM_SPECIALSNIPER = DarkRP.createJob("SWAT Sniper", {
color = Color(0, 43, 112, 255),
model = {
"models/omgwtfbbq/quantum_break/characters/operators/monarchoperator01playermodel.mdl",
},
description = [[You are part of the tactical branch of the Civil Protection. Use the tools at your disposal to keep the streets free from crime.]],
weapons = {"m9k_usp","m9k_aw50"},
command = "swatsniper",
max = 1,
salary = 200,
admin = 0,
vote = true,
candemote = true,
hasLicense = true,
PlayerLoadout = function(ply)
ply:SetHealth(100)
ply:SetArmor(100)
end,
category = "Government",
})
I'm not sure exactly what the issue is. If anyone has any ideas, I'd appreciate them. Thanks in advance.
Im taking a look at the Error right now, but something else: For the playermodel you provide a table. Which only includes on model..thats kinda useless..if you use one model you can just do one string, if you use several models THEN you need a tabel
Sorry, you need to Log In to post a reply to this thread.