I am trying to make a custom scoreboard for my server for fun and learning's sake.
Could anyone link me to some sort of tutorial because I looked at already existing scoreboards and couldn't understand what was going on.
Thanks
The base gamemode scoreboard should be straight-forward, although instead of it defining functions like function PANEL:Init( ) ... end, it uses a table like PLAYER_LINE = { Init = function( ) ... end; };
So, vgui can be simple to complex. Basically each vgui element is one to many elements stuck in one. For example a DButton is derived from DLabel and it can add a DImage to the mix too, so it is by default just a DLabel with some extra functionality.
So, a scoreboard is essentially a shell element ( something that takes up x amount of space and has the container to hold the repeating player rows ), and a player-row element which gets repeated many times. It is typical for the shell to have many labels, or be drawn from Poly's by overriding Paint, or be a lot of vgui elements put together. On top of that, there's typically a container, something which holds the player information element.
The player information element or player row is typically a vgui element which has an AvatarImage, several DLabels ( ping, name, rank, etc... ), maybe some DImages ( for icons ), etc... This element will be created many times over in order to display all players on the scoreboard.
The base game-mode scoreboard calls the player row element PLAYER_LINE. The base game-mode scoreboard calls the shell element SCORE_BOARD.
When the scoreboard is opened, it gets created by: g_Scoreboard = vgui.CreateFromTable( SCORE_BOARD )
In the SCORE_BOARD Init function it creates the container where the player rows will go, and it is a DScrollPanel
For each player a PLAYER_LINE element is created and inserted: self.Scores:AddItem( pl.ScoreEntry )
Sorry, you need to Log In to post a reply to this thread.