LUA error. i canot fix.

Alright. So i left my DarkRP server for a while. and i am just coming back to reboot it. and get it running again. (i am very rusty with coding its been along time) So i get this error.

Here is the error.

[ERROR] A runtime error has occurred in “addons/darkrpmodification-master/lua/darkrp_customthings/jobs.lua” on line 679.
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 679
  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 86
    ------- End of Simplerr error -------

i remember getting this in the past. But i cant seem to fix it.

Would you mind posting your script (or just the code for the job in which this error is occurring, around line 679 )?

Can you post your jobs.lua file from lines 650-680 in


 tags?

Here is the code you guys need.

–[[---------------------------------------------------------------------------
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,
Line 679> [TEAM_SWATCHIEF] = true,
[TEAM_SWAT] = true,
[TEAM_SWATMEDIC] = true,
[TEAM_SWATSNIPER] = true
}

Do all those teams in the table exist? More specifically, TEAM_SWATCHIEF, TEAM_SWAT, and TEAM_MAYOR.

They do. mayor is a custom one. He gets demoted when he dies. And the rest of those jobs. are in the game mode itself. And they are there.

Are you sure this is jobs.lua and not jobsrelated.lua?

Anyway, if this is indeed jobs.lua, I think that error means that TEAM_SWATCHIEF doesn’t exist, so make sure the job exists in your jobs.lua and isn’t throwing errors.

Also ensure TEAM_SWATCHIEF isn’t misspelled in your jobs.lua.