Table HasValue Help

I am trying to edit a script i do not understand at all so sorry if this sounds completely weird. I am trying to change the config a bit in this addon called “DarkRP Economy 2”. Currently in the config, to place a team in a certain variable, you must put the “Team String” as in “Citizen” instead of “TEAM_CITIZEN”. The code behind the config looks like this.

table.HasValue(Config.NoRobbingJobs, team.GetName(activator:Team())

and the config looks like this

Config.NoRobbingJobs = { "Pet", "Police", "Citizen" }

I would like for the config to look like this



Config.NoRobbingJobs = { "TEAM_PET", "TEAM_POLICE", "TEAM_CITIZEN" }

How would i edit tablevalue to do this?
Thank you in advance anyone attempting to help!

[lua]table.HasValue(Config.NoRobbingJobs, activator:Team())[/lua]
[lua]Config.NoRobbingJobs = { TEAM_PET, TEAM_POLICE, TEAM_CITIZEN }[/lua]

I have tried that but no luck with it sadly.

If that doesn’t work, it means there’s other factors that prevent it from doing so. There are several possibilities, but I don’t have the time to describe them all, so hopefully someone else can help you.


This will throw an error, if something isn’t working properly then please include the errors, if any. Saying “is no work” will get no one anywhere.

Either have the table empty and insert all the jobs on initpostentity or define the table and insert the jobs on initpostentity.

Hook Library Usage


I don’t understand why people disagree with you, because you are correct. TEAM_ variables are defined by the gamemode and you want to make sure they’re already defined by the time you create this table.
It won’t throw an error but the table will be declared as {nil, nil, nil} which is basically the same as an empty table {}.

I’m not entirely sure about this so please correct me if I’m wrong.

You’re right, unless TEAM_PET, TEAM_POLICE and TEAM_CITIZEN is actually declared as a number or something etc(anything which isn’t false or nil).
You should set the table to Config.NoRobbingJobs = { TEAM_PET = true, TEAM_POLICE = true, TEAM_CITIZEN = true }

The correct thing to do would be table = {[TEAM_WHATEVER] = true};

However, that still needs to be done in initpostentity or other similar hooks else you would get error, table index is nil.