How do I get the playermodel location (string) of every player on a certain team

I’m honestly not sure how to do this since everything that lists players in a table returns it as the player entities. I’d like to get it to return the playermodel string so I can list all the players in each team with spawn icons.

Secondly, is it possible to get the names of the players to show up in those little yellow speech bubbles when you move your cursor over them?

I made an attempt using “player_manager.AllValidModels()”, but obviously that just gave me a list of all the avaliable player models.

[lua]group1menu = vgui.Create(“DModelSelect”, groupslist )
group1menu:SetSize( 300, 300 )
group1menu:SetSpacing( 5 )
group1menu:EnableHorizontal( true )
group1menu:EnableVerticalScrollbar( false )
group1menu:SetPadding( 4 )

for k,v in pairs(player_manager.AllValidModels( )) do
local group1list = vgui.Create( “SpawnIcon”, group1menu )
group1list:SetModel( v )
group1menu:AddItem( group1list )
end [/lua]

If you can help, Thanks!

[lua]
group1menu = vgui.Create(“DModelSelect”, groupslist )
group1menu:SetSize( 300, 300 )
group1menu:SetSpacing( 5 )
group1menu:EnableHorizontal( true )
group1menu:EnableVerticalScrollbar( false )
group1menu:SetPadding( 4 )

for _, pl in pairs( team.GetPlayers( TEAM_WHATEVER ) ) do – loop through all the players on TEAM_WHATEVER

local spawnicon = vgui.Create( "SpawnIcon", group1menu )
spawnicon:SetSize( 60, 60 ) -- pick a size?
spawnicon:SetModel( pl:GetModel() ) -- get their model, set the spawnicon to it
spawnicon:SetTooltip( pl:Nick() ) -- "little yellow speech bubbles when you move your cursor over them"
group1menu:AddItem( spawnicon )

end[/lua]

Give that a go :slight_smile:

http://img233.imageshack.us/img233/3533/2011112700002.jpg

Uploaded with ImageShack.us

It doesn’t open, it just gets stuck like this, it might be a sizing issue but I’m not sure

[lua]local groupslist = vgui.Create(“DCollapsibleCategory”, Character)
groupslist:SetPos(25, 50)
groupslist:SetSize( 450, 50 ) – Keep the second number at 50
groupslist:SetLabel( “Groups” )

local group1 = vgui.Create(“DLabel”, groupslist)
group1:SetPos(20,20)
group1:SetColor(Color(255,255,255,255))
group1:SetFont(“default”)
group1:SetText(groupsnamesasdf[1])
group1:SizeToContents()

group1menu = vgui.Create(“DModelSelect”, groupslist )
group1menu:SetPos(40, 40)
group1menu:SetSize( 300, 600 )
group1menu:SetSpacing( 5 )
group1menu:EnableHorizontal( true )
group1menu:EnableVerticalScrollbar( false )
group1menu:SetPadding( 4 )

for _, pl in pairs( team.GetPlayers( 1 ) ) do – loop through all the players on TEAM_WHATEVER

local spawnicon = vgui.Create( "SpawnIcon", group1menu )
spawnicon:SetModel( pl:GetModel() ) -- get their model, set the spawnicon to it
spawnicon:SetTooltip( pl:Nick() ) -- "little yellow speech bubbles when you move your cursor over them"
group1menu:AddItem( spawnicon )

end[/lua]

groupslist:SetSize( 450, 50 ) – Keep the second number at 50

Why?

Isn’t it needed, since it’s a collapsible category?

Is that not the size it expands to though?

From the picture, it looks like it.