Server sided HUD.

How do I take a HUD like minimalist

and make it so that everyone that plays on the server will have that HUD?

I have my own special way. :3
Btw, I haven’t done this in awhile and I would return to my custom hud I made, but I deleted it. Q.Q
There are definitely better ways to do this.

[lua]
function hpbar( ply )
if name == “CHudHealth” or name == “CHudBattery” then return false end
local hp = LocalPlayer():Health()
local armor = LocalPlayer():Armor()
local middlex = (ScrW()/15-50)
local bottomy = (ScrH()-160)

	if armor < 0 then
		armor = 0
	end
	if hp < 0 then
		hp = 0
	end
	local FinalArmor = armor*2.5+10
	local FinalHp = hp*2.5+10
	local ply = LocalPlayer()

	draw.RoundedBox(8,middlex,bottomy+30,340,120,Color(0,0,0,200)) ------------------------Main Grey Background
	draw.RoundedBox(8,middlex+3,bottomy+33,200,30,Color(200,0,0,200)) ---------------------vvv Background
	draw.SimpleText(team.GetName(ply:Team()),"Trebuchet24",middlex + 23,bottomy+48,Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
	draw.RoundedBox(8,middlex+12,bottomy+72,260,31,Color(0,150,0,200)) --------------------Hp background
	draw.RoundedBox(8,middlex+12,bottomy+113,260,31,Color(0,150,0,200)) -------------------Armor Background
	draw.RoundedBox(8,middlex+12, bottomy+113,FinalArmor,31,Color(0,255,0,200)) ------------------Changing Armor
	draw.SimpleText(armor,"Trebuchet24",middlex+225,bottomy+128,Color(0,0,0,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
	draw.SimpleText(hp,"Trebuchet24",middlex+225,bottomy+87,Color(0,0,0,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) --Changing Hp
	
if hp > 90 and hp <= 100 then --------------------------------------------------------- vv Health Status
	Color1 = 0, Color2 = 255, Color3 = 0
	draw.RoundedBox(8,middlex+12,bottomy+72,FinalHp,31,Color(Color1,Color2,Color3,200)) ----------------Changing Hp bar
	draw.SimpleText("Healthy","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
elseif hp > 70 and hp <= 90 then
	Color1 = 173, Color2 = 225, Color3 = 47
	draw.RoundedBox(8,middlex+12,bottomy+72,FinalHp,31,Color(Color1,Color2,Color3,200)) ----------------Changing Hp bar
	draw.SimpleText("Hurt","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
elseif hp > 60 and hp <= 70 then
	Color1 = 154, Color2 = 205, Color3 = 50
	draw.RoundedBox(8,middlex+12,bottomy+72,FinalHp,31,Color(Color1,Color2,Color3,200)) ----------------Changing Hp bar
	draw.SimpleText("Slightly Wounded","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
elseif hp > 40 and hp <= 60 then
	Color1 = 255, Color2 = 255, Color3 = 0
	draw.RoundedBox(8,middlex+12,bottomy+72,FinalHp,31,Color(Color1,Color2,Color3,200)) ----------------Changing Hp bar
	draw.SimpleText("Wounded","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
elseif hp > 30 and hp <= 40 then
	Color1 = 255, Color2 = 165, Color3 = 0
	draw.RoundedBox(8,middlex+12,bottomy+72,FinalHp,31,Color(Color1,Color2,Color3,200)) ----------------Changing Hp bar
	draw.SimpleText("Badly Wounded","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
elseif hp > 20 and hp <= 30 then
	Color1 = 255, Color2 = 99, Color3 = 71
	draw.RoundedBox(8,middlex+12,bottomy+72,FinalHp,31,Color(Color1,Color2,Color3,200)) ----------------Changing Hp bar
	draw.SimpleText("Critically Injured","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
elseif hp >= 1 and hp <= 20 then
	Color1 = 255, Color2 = 0, Color3 = 0
	draw.RoundedBox(8,middlex+12,bottomy+72,FinalHp,31,Color(Color1,Color2,Color3,200)) ----------------Changing Hp bar
	draw.SimpleText("Near Death","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
end
if hp > 0 then
	draw.SimpleText(hp,"Trebuchet24",middlex+225,bottomy+87,Color(0,0,0,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER) --Changing Hp
end
if hp <= 0 then
	draw.SimpleText("Dead","CustomHUDFont2",middlex + 30, bottomy + 87, Color(0,0,0,255),TEXT_ALIGN_LEFT,TEXT_ALIGN_CENTER)
end

end
hook.Add(“HUDPaint”,“hpbar”,hpbar)
[/lua]

Then you mess with draw.RoundedBox and draw.SimpleText

Too lazy to write another quick code, so: http://wiki.garrysmod.com/?title=Simple_HUD_Tut

Edit: I foundz mah old HUD I made ( replica of TTT one )
Just use this as an example if you want

The Minimalist HUD already deletes the old HUD, but for some reason when other people join, they can’t see the custom HUD, and only I can, it’s not in my addons, its in the gamemode folder, but it still doesn’t work

Send it to the client **[G.AddCSLuaFile

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.AddCSLuaFile)**

If I had seen your last post before I went searching for my Hud again, I woulda said the same thing ^^^.

So would I just put the necessary code into my HUD file, or a cl_init/init file

make another file for your HUD and then do AddCSLuaFile( ‘name of hud file.lua’ ) in the init.lua

EDIT: Yes, it isn’t needed but just better to find it so it’s not in a 1000 file long cl_init.lua …

Yea
Just take the HUD code and place it in your gamemodes file called cl_init.

You dont neccesary need to make a new file. Yes its more orginized that way, but you dont need to.

Please pardon my incompetence, but would this go in my Gamemode files with the init and everything else, or would I put a cl_init into my lua/autorun/client and AddCSLuaFile

No, into the gamemode files. Two choices

Put the HUD code into cl_init so you don’t have to add another client side file.

Make a file and put HUD code here. Then AddCSLuaFile( ’ name of HUD file.lua’ ) in init.lua

EDIT: No Idea, but there should be one…

I suppose you have your own gamemode you want this HUD for? Yes, alright.

Go to your gamemode folder. Open cl_init and put in all of the HUD code there.
Take the HUD pictures and place them into your gamemode content/materials folder.

That shuld do it.

Yea 100 post :slight_smile:

Edit:
Nija’d. Why is there no notification when someone posted while you where posting like SMF has :confused:

The whole code for the HUD or just the AddCSLuaFile( “cl_serverHUD.lua” )

The whole code for the HUD. otherwise make another file for the hud and put AddCSLuaFile into init.lua

Ok it works, thanks.