Custom On-Screen Message?

So, Below I will also leave a picture, but I would like something for my Defcons so it always displays until I turn it off.
I dont care how it looks, just want it there so someone doesnt have to spam CSAY and/or type it in when changing.

Top left, Where it says Defcon 3. I want something like that.
What do I do and how?

Start with



surface.DrawPoly to draw the circle,

draw.RoundedBox to draw the box,

surface.DrawTexturedRect to draw the warning, and

draw.SimpleText to draw the text.


if SERVER then
    util.AddNetworkString( "dirtydirtynetstring" )
    local ply = FindMetaTable( "Player" )
    function ply:Custom_Notify( txt, len )
        net.Start( "dirtydirtynetstring" )
        net.WriteString( tostring( txt ) )
        net.WriteUInt( len, 8 )
        net.Send( self )
    net.Receive( "dirtydirtynetstring", function()
        local f         = vgui.Create( "DPanel" )
        f.txt           = net.ReadString()
        f.removeTime    = net.ReadUInt( 8 )
        f:SetSize( 200, 100 )
        f:SetPos( 50, 50 )
        f:SetAlpha( 0 )
        f:AlphaTo( 255, 0.3, 0, nil )
        function f:Paint( w, h )
            draw.RoundedBox( 4, 0, 0, w, h, color_white )
            draw.SimpleText( self.txt, "DermaDefault", w/2, h/2, color_black, 1, 1 )
        timer.Simple( f.removeTime, function()
        end )
    end )

God bless derma

edit oh lol I totally didnt read what he wanted

Wait so…
Where do I put this? And how do I enable/disable it?

I thought HUDPaint was client-side only?

Yes it is

How do I go about making this server wide?
I am using it to notify players of the current defcon. Is there a way I can use the HUDPaint server-wide?

You don’t, hud is something that clients watch, not server or cpu itself
You have to network whatever you want

If you use the HUDPaint hook on the client, it’ll paint it to every client already. If how you detect defcons is serverside, then you need to network. If it can be detected clientside, then no networking needed.

I don’t think you guys what networking is nor what the states of Lua mean. Lemme teach you :magic101:

Within Garry’s Mod’s Lua environment there exists 2 primary states excluding the menu state which is essentially the clientside state with higher control over your Garry’s Mod client. These two states are known as clientside and serverside. With respects to the name, clientside exists only on the client (i.e. playable game) and normally operated independently without affecting the serverside state. The serverside state on the other hand contains game logic, game rules, and controls the clients connected to the server. The serverside state usually cannot work independently outside of networking without affecting the clientside state.’s%2BMod.jpg[/T]

Clientside State

The clientside state does not represent a centralized system of clients. Instead, the clientside state refers to every player connected and what each player can observe through their computer (e.g. HUD elements, sounds, drawn geometry). You could think of the clients as a bunch of students in a classroom, one cannot cannot simply take over and dictate everyone, instead they would need to communicate with the precessor (i.e. server) of the class room. To reiterate, A client cannot directly influence other clients in their nature unless they send a message to the server and it gets distributed accordingly based on the server’s discretion.


Serverside State

The best way to think of the serverside state is the professor of a classroom. The professor in this scenario can lecture to their students, kick them out, give them all a PowerPoint or ask one of their students for a small conference after class. The serverside state directly influences it’s players through networking whether it be all of them, or a select focus group of players (e.g relay a message to admins).

’Shared’ State

First and foremost there’s no such thing as ‘shareside’ because shared mearly refers to the Lua file is accessable from both the client and the sender. How both states interpret that data is entirely based on it’s resulting conditions unsure unique to each state. But yeah, there is no shared state so stop trying to make a variable in the shared state and maintain it’s value on both states without networking it.

For more information: