Helpplayer list with groups

Posts 115 of 31 · Page 1 of 3
player list with groups
so I've been working on this little piece of code and I figured it out but my problem is that when you use it, the names overlap eachother.

does anyone know how to fix the overlap issue and how to put the corresponding player group next to the names?



Code:
surface.CreateFont( "******font", {
	font = "Arial",
	size = 13,
	weight = 750,
	blursize = 0,
	scanlines = 0,
	antialias = false,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = true,
	additive = false,
	outline = true,
} )

local topleft = TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP



hook.Add( "HUDPaint", "watermark", function()
for k,v in pairs( player.GetAll() ) do
draw.DrawText( "players: \n"..v:Nick(),"******font", 0, 0, Color( 0,255,0,255 ), topleft )
end
end)
Quote Originally Posted by lolman59 View Post
so I've been working on this little piece of code and I figured it out but my problem is that when you use it, the names overlap eachother.

does anyone know how to fix the overlap issue and how to put the corresponding player group next to the names?



Code:
surface.CreateFont( "******font", {
	font = "Arial",
	size = 13,
	weight = 750,
	blursize = 0,
	scanlines = 0,
	antialias = false,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = true,
	additive = false,
	outline = true,
} )

local topleft = TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP



hook.Add( "HUDPaint", "watermark", function()
for k,v in pairs( player.GetAll() ) do
draw.DrawText( "players: \n"..v:Nick(),"******font", 0, 0, Color( 0,255,0,255 ), topleft )
end
end)
go skid somewhere else plz?
hahah im really really blind
anyone?
local yPos = 12;
draw.DrawText( "players: \n"..v:Nick(),"******font", 0, yPos, Color( 0,255,0,255 ), topleft )
yPos = yPos + 12;
Quote Originally Posted by gayguy911 View Post
local yPos = 12;
draw.DrawText( "players: \n"..v:Nick(),"******font", 0, yPos, Color( 0,255,0,255 ), topleft )
yPos = yPos + 12;
That didn't work, it only displays the name of the last player, i want all the players to be displayed and their group next to their name.
Use a line variable, multiply the line variable by the text height, add the product to your 'y' coordinate, and increment the line variable after each iteration of the loop.
Quote Originally Posted by GBAERHAEHhAER%YHG%RY%yh View Post
Use a line variable, multiply the line variable by the text height, add the product to your 'y' coordinate, and increment the line variable after each iteration of the loop.
you should have a little extra padding, like 4-12 pixels instead of just the text height or it will look ugly as fuck
Quote Originally Posted by GBAERHAEHhAER%YHG%RY%yh View Post
Use a line variable, multiply the line variable by the text height, add the product to your 'y' coordinate, and increment the line variable after each iteration of the loop.
Example please?
you need to establish where you wanna draw on screen but here is snippet

Code:
		local line = 1
		for k, v in pairs(******PKillVars.players) do
			draw.DrawText(
				k .. '. ' .. v:Name(),
				'******_font',
				******PKillVars.BOX_X + ******PKillVars.BOX_PADDING,
				******PKillVars.BOX_Y + ******PKillVars.BOX_PADDING + (******PKillVars.TEXT_HEIGHT * line),
				k == ******PKillVars.selected and ******PKillVars.TEXT_COLOUR_SELECTED or ******PKillVars.TEXT_COLOUR,
				TEXT_ALIGN_LEFT
			)
			line = line + 1
		end
Quote Originally Posted by GBAERHAEHhAER%YHG%RY%yh View Post
you need to establish where you wanna draw on screen but here is snippet

Code:
		local line = 1
		for k, v in pairs(******PKillVars.players) do
			draw.DrawText(
				k .. '. ' .. v:Name(),
				'******_font',
				******PKillVars.BOX_X + ******PKillVars.BOX_PADDING,
				******PKillVars.BOX_Y + ******PKillVars.BOX_PADDING + (******PKillVars.TEXT_HEIGHT * line),
				k == ******PKillVars.selected and ******PKillVars.TEXT_COLOUR_SELECTED or ******PKillVars.TEXT_COLOUR,
				TEXT_ALIGN_LEFT
			)
			line = line + 1
		end
That won't work.

it gives me this error

Code:
[ERROR] lua/players.lua:2: attempt to index global '******PKillVars' (a nil value)
  1. unknown - lua/players.lua:2
Quote Originally Posted by lolman59 View Post
That won't work.

it gives me this error

Code:
[ERROR] lua/players.lua:2: attempt to index global '******PKillVars' (a nil value)
  1. unknown - lua/players.lua:2
you dumb autist you aren't going to just c+p it in and it works magically
1337 copypastaaaaaaaaaa
i coded this in the mpgh reply box so if its garbage enjoy it anyway
Code:
local stoofs = {}
stoofs.curY = 20
function stoofs.EpicHack()
   for i = 0, #player.GetAll() do
   local ply = player.GetAll()[i]
       surface.SetTextColor(Color(255,200,200,120))
       surface.SetFont("Arial")
       surface.SetTextPos(20, stoofs.curY)
       surface.DrawText(ply:Name())
       stoofs.curY = stoofs.curY + 20
end
hook.Add("HUDPaint","DarkRPF4HUD",stoofs.EpicHack)
might not even work but it has all the concepts you need to make it work yourself
draw.DrawText makes me want to enjoy shooting myself
why does the draw class make u suicidal? the method you used the surface class is virtually identical to draw class (wrapper)

also why are you calling players.GetAll() every iteration??
Posts 115 of 31 · Page 1 of 3

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?