DrawText on Frame (Derma, Panel, VGUI)

How can I draw the Steam ID, Nick and etc.

Do I use the draw.DrawText function ?

( I know its a really stupid question )

There’s two ways, you can either or the draw.DrawText or use a DLabel. For the actual text, if you defined ply use ply:Nick(), or above your code put local ply = LocalPlayer(), then in the draw part do ply:Nick()

Yeah, as the post above says, there are many ways to draw text. Commonly

draw.DrawText is used, but you can also use

draw.SimpleText, or

surface.DrawText (which each of those other text functions uses internally). But, those things there are only really practical if you’re using the derma panel’s paint function to draw the text. If not, as the other post says, it’s probably best to use a DLabel.

Also, you can get the things you wanted from the player by doing something like this:

local ply = LocalPlayer()

local steamid = ply:SteamID() -- or SteamID64() if you want a 64 bit ID
local nickname = ply:Nick()

-- do your text stuff here

I did this but using tables

[lua]FrameCAthos = {}

FrameCAthos.Nick = "Name: "…ply:Nick()
FrameCAthos.SteamID = "SteamID: "…ply:SteamID()
FrameCAthos.MainColor = Color( 50, 50, 50, 255)

And it worked but thanks anyway

[editline]24th March 2016[/editline]

How could I do that with a DarkRP job to get teh DarkRP Job, Salary and Wallet and put in this panel ?

I’ve never actually played or coded for DarkRP, but based on a couple of websites:


These will work just as well:


local rpname = LocalPlayer():getDarkRPVar('rpname')

		local Name = vgui.Create( "DPanel", Frame ) -- Name
		Name:SetPos( ScrW() / 2 - 630, ScrH() / 2 - 322.5 )
		Name:SetSize( 575, 40 )

		local nametext = vgui.Create( "DLabel", Name )
		nametext:SetPos( 10, 10 )
		nametext:SetSize( 35, 50 )
		nametext:SetColor(Color(255,255,255,255)) // Color
		nametext:SetText("Name: " ..rpname ) // Text
		nametext:SizeToContents() // make the control the same size as the text.

		function Name:Paint( w, h )
			draw.RoundedBox( 2, 0, 0, w, h, Color( 209, 209, 209 ) ) 

This is a snippet of some code I have, this should be fairly easy to understand