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:
[CODE]
Buttonjob.DoClick = function()
local jobsList = DermaMenu()
for k, v in pairs(team.GetAllTeams()) do
jobsList:AddOption(v.Name, function() end)
end
jobsList:Open()
end
[/CODE]
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...
Thanks!
You could try looking in the f4 module for darkrp and throw something together from there.
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:
[lua]
-- crappy example
for k,v in pairs(RPExtraTeams) do
if k == TEAM_CITIZEN then
-- only print if job is citizen
print(v.name, v.description)
end
end
[/lua]
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.
Sorry, you need to Log In to post a reply to this thread.