All current players on Derma menu?

Hello, need someone to help me.
How can i add all current players online onto my Derma Menu?

[editline]23rd November 2016[/editline]

I would also need to be able to click on them and then allow someone to do something.

local menu = DermaMenu()
for k,v in pairs(player.GetAll()) do
menu:AddOption( v:Nick(), function() MsgN("You clicked on "…v:Nick()) end )

This is how I would do it, it also adds the ability to have a scroll bar and you can add buttons to players to do something. Its bigger and uglier than gonzalogs but it does the job well.

local DermaFrame = vgui.Create("DFrame") -- Make your frame to put your list in
	DermaFrame.Paint = function (s,w,h)
		draw.SimpleText("My New Derma!","FONT",175,15, Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)

	local UserListScrollBar = vgui.Create("DScrollPanel", DermaFrame) -- This means you can scroll up and down, unless your only expecting a few players and its not needed
		local UserList = vgui.Create("DListLayout", UserListScrollBar)
			UserList:SetSize(350,3840) -- You want this 128x your UsersList:SetSize(x,y) y value as max of 128 players on a server
			for k, v in pairs(player.GetAll()) do
				local Users = vgui.Create("DPanel", UserList)
						Users.Paint = function(s,w,h)
							if v:IsValid() then -- This is important as if a player DC's your list will throw errors if this is not in
								draw.SimpleText(v:Nick(),"FONT",5,15,Color(255,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER) -- Your player name
								draw.SimpleText("Disconnected","FONT",5,15,Color(255,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER) -- This is important as if a player DC's your list will throw errors if this is not in

You can also customise your scroll bar with GetVBar. You also probably don’t have to use draw.SimpleText, but I haven’t experimented with anything else, id assume SetText() would throw errors on player disconnected though. To add buttons you have to make a DButton and parent it off the UserList DPanel.

Gonza gave u an idea. If you are looking for that menu. Other ideas good but gonza gave u the simple easy version.

Sir TEST coming in here with the greatest answer of all, a disagree rating. If he did something wrong, why not correct him?

He does rate spam

He does, it’s absolutely ridiculous.

Hello, so i have chosen to use bings design, was wondering if someone could tell me if i was to click on a name how could i make it so if i press a button it will do something to the player that was selected?

So what i mean is:

  1. Press on the name ( It Highlights It )
  2. There is a button on the side which allows me to press and it would do a function e.g. kill.

Many Thanks :smiley:

Why not just create a dcombo box on a frame and have a dbutton with the words kill that kills the selected player? If not you could probably create the button when you do OnSelect.

Alright, thanks a lot guys :smiley: