Getting names of all teams and display them in derma
5 replies, posted
Hello everyone, I am currently having issues with retrieving team names.
local characterpanel = vgui.Create( "DPanel", sheet )
for k, v in pairs(team.GetAllTeams())do
local JobPanel = vgui.Create("DPanel", JobList)
JobPanel:SetSize(JobList:GetWide(), 50)
JobPanel:SetPos(0,0)
JobPanel.Paint = function()
draw.RoundedBox(0, 0, 0, JobPanel:GetWide(), JobPanel:GetTall(), Color(50, 50, 50, 255))
draw.RoundedBox(0, 0, 49, JobPanel:GetWide(), 1, Color(255, 255, 255, 255))
draw.SimpleText("PrintTeamNameHere", "DermaDefault", 20, 10, Color(255, 255, 255))
end
end
I have a derma panel where I want all the team names to be displayed, so I thought of making a loop for each team that is available and then create a JobPanel for each single team. The problem is that I can't figure it out how to print the team name.
Could anyone help me with this?
Thanks in advance!
team.GetAllTeams()
for k, v in pairs(team.GetAllTeams()) do
-- ..
draw.SimpleText(v.Name, "DermaDefault", 20, 10, Color(255, 255, 255))
-- ..
end
If you read the team.GetAllTeams wiki page and look at the example you can see that the keys are the TEAM enumerations and that the values are tables with the team's information. So you could just do v.Name to get the team's name.
Thanks alot, it's working now!
unfortunately I am having another problem now and that is when I switch from DPropertySheets it still gets displayed ?
You're not setting JobPanels' parent to characterpanel and to remove TEAM_CONNECTING just do
if k == TEAM_CONNECTING then continue end
before you create the panel.
Thanks! I have fully resolved it now
Sorry, you need to Log In to post a reply to this thread.