Lua Error

Tried to add a lua hook for Police jobs to start out with body armor, didn’t work, so I tried to remove it and it F’d up my whole DarkRP server.

Here’s the error from console:

[ERROR] gamemodes/darkrp/gamemode/shared.lua:557: table index is nil

  1. unknown - gamemodes/darkrp/gamemode/shared.lua:557
  2. include - [C]:-1
  3. unknown - gamemodes/darkrp/gamemode/init.lua:92

IDK what to do to fix it, still pretty new to Lua.
Any ideas?

If you could show us the actual code… (Shared.lua from around 550 to 570)

No problem

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

/---------------------------------------------------------------------------
Enable hitman goodies on this team
---------------------------------------------------------------------------
/
DarkRP.addHitmanTeam(TEAM_HITMAN)

[editline]2nd October 2013[/editline]

Thought I would give more info.
I tried to add this hook at the bottom of two different files.

hook.Add(“PlayerSpawn”, “CustomTeamArmor”, function(ply)
if ply:Team() == TEAM_POLICE then
ply:SetArmor( 25 )
elseif ply:Team() == TEAM_CHIEF then
ply:SetArmor( 25 )
elseif ply:Team() == TEAM_MAYOR then
ply:SetArmor( 15 )
elseif ply:Team() == TEAM_SWAT then
ply:SetArmor( 50 )
elseif ply:Team() == TEAM_SWATCOMMAND then
ply:SetArmor( 50)
else
ply:SetArmor( 0 )
end
end)

The two files were: init.lua and garrysmod\lua\autorun\server\admin_functions.lua

IDK what it did, but it gave me the error that I posted above, so I deleted the hook.
But the error remained even after multiple server restarts.

[editline]2nd October 2013[/editline]

Nvm, figured it out on my own :stuck_out_tongue: