How do I get a table of all teams in DarkRP? Im trying to make an admin tool which force changes somones job. I have made a context menu like so:
Buttonjob.DoClick = function()
local jobsList = DermaMenu()
for k, v in pairs(team.GetAllTeams()) do
jobsList:AddOption(v.Name, function() end)
Which works fine, shows all the jobs names perfectly except theres one small problem. Now I have the names of the jobs, Id like the actual TEAM names for them, for example:
TEAM_POLICE, TEAM_WHATEVER so I can actually change the players job.
Any ideas? I know I’m missing something really simple…
You could try looking in the f4 module for darkrp and throw something together from there.
in the for loop, k will be the team id, if I’m not mistaken.
Looks like you are looking for RPExtraTeams.
Keys = index = value of variable TEAM_XXX
Values = job table = table passed into AddExtraTeam/DarkRP.createJob with name key being job name.
Here’s a rubbish example:
– crappy example
for k,v in pairs(RPExtraTeams) do
if k == TEAM_CITIZEN then
– only print if job is citizen
In that case you could just do RPExtraTeams[TEAM_CITIZEN] and bypass the for loop but it shows you how the table is made up.