Scoreboard help

So I’ve been looking for scoreboard tutorials since i can’t really get an idea how to start, coudln’t find any.
So can someone link me to one and post one if possible?

Was wondering though, inside the scoreboard how exactly would i go about adding catergories such as “props”
and show the amount.


There is a very simple scoreboard. You can start from it.

[lua]surface.CreateFont( “coolvetica”, 42, 500, true, false, “HeaderFont” )
local SCOREBOARD_WHITE = Color(255,255,255,255)
local SCOREBOARD_BG = Color(120,90,60,200)
local SCOREBOARD_LINE = Color(100,70,60,200)
local SCOREBOARD_FADE = Color(20,20,20,70)

local SCOREBOARD_OFF = 101
local C_FRIEND = Color(80,150,80,255)
local C_BLOCK = Color(150,80,80,255)
local C_REQ = Color(150,150,80,255)

function GM:ScoreboardShow()
self.ShowSB = true

function GM:ScoreboardHide()
self.ShowSB = false

function GM:HUDDrawScoreBoard()
if (!self.ShowSB) then return end

local NPly 		= #player.GetAll()
local Tall 		= SCOREBOARD_OFF + 20 * NPly + 20
local y 		= ScrH() / 2 - Tall / 2
local by 		= y + SCOREBOARD_OFF
local Grad 		= surface.GetTextureID("gui/gradient")
surface.DrawRect(SCOREBOARD_X, by, SCOREBOARD_WIDTH, NPly*20)

draw.SimpleText(GetHostName(), "HeaderFont", SCOREBOARD_X + 20, y + 20, SCOREBOARD_WHITE)

for k,v in pairs( player.GetAll() ) do
	local S = v:GetFriendStatus()
	local Y = by + 20 * (k-1)
	if (S == "friend") then 
		surface.SetTexture( Grad )
		surface.SetDrawColor( C_FRIEND )
		surface.DrawTexturedRect(SCOREBOARD_X, Y, SCOREBOARD_WIDTH/2, 20 )
	elseif (S == "blocked") then
		surface.SetTexture( Grad )
		surface.SetDrawColor( C_BLOCK )
		surface.DrawTexturedRect(SCOREBOARD_X, Y, SCOREBOARD_WIDTH/2, 20 )
	elseif (S == "requested") then
		surface.SetTexture( Grad )
		surface.SetDrawColor( C_REQ )
		surface.DrawTexturedRect(SCOREBOARD_X, Y, SCOREBOARD_WIDTH/2, 20 )
	draw.SimpleText(v:Nick(), "Trebuchet18", SCOREBOARD_X + 2, Y, SCOREBOARD_WHITE)
	draw.SimpleText(v:Ping(), "Trebuchet18", SCOREBOARD_X + SCOREBOARD_WIDTH - 30, Y, SCOREBOARD_WHITE)



thank you

another question though, how exactly could i go about making catergories for teams(specfically darkrp jobs) and get the player listed under them?

noob question as well: How can i get this running without replacing the orginal one? I tried running it in autorun and what not, but can’t get it to work.



You want two scoreboards on top of eachother?

No, what i was saying how do i get this one running without having to replace the orginal scoreboard,
obviously i can’t do that because if you look at the code it disables the orginal one anyway.

If you are making a gamemode just put this scoreboard.lua to the gamemode folder and include it in cl_init.lua (And AddCSLuaFile in inti.lua)

Gotcha. Thanks for the example, but…
I’m not 100% on following this, i’ve been messing around with it but for bigger than minor changes i get errors.

Not to turn this into a request thread but,
could you possibly make a rounded box parenting under the host name(a little ways down) with any text, then make another rounded box( the contains the py:nick and such) parenting under the other roundedbox?

Thats what i was trying to do but i screwed up drastically. i just want to see how you do it correctly.

Thanks helping me in your free time if you do it.

I find that when attempting something new and unknown it helps to get instant results, for that I like to use Luapad 1.11 there are newer version on there but when i tried either 1.15 or 1.17 it had problems so I went back to 1.11. It can only save as .txt, but I hardly ever save I just copy paste to/from notepad++. It’s great for menu’s and such, you can change things, run it, change again, run again, etc. until what you are working on looks right. Just remember to check for errors after each run. just be careful not to change variable names, like if you did hook.Add(“Think”, “fudge”, someWIPFunction) and then you change the fudge to frack. fudge will still be running, you need to use the same hook/timer/function names or get multiple copies of what you are working on running, or run the old name with an empty function.

You know if you did a short example for him, it would help the lua newbies right!

create a table for each team, if( player:Team() == “team” ) then table.insert(team1, player:Nick()) end, and then loop through each team table and draw their name an w/e you want

Thanks, I hanv’t really even gotten to that part yet though, thats on hold:p

just currently trying to figure out the whole vgui and stuff.

What I’m really trying to see how to do, is how to create a new layout such as draw.RoundedBox.
And figure out how to “parent” it to other things. Like in Derma.

uhh. does it make sense what im have troubling with? if not, ill try to explain more clearly.


Eh, just ignore this, I’ll go to the request section.