All pastes #2052215 Raw Edit

Someone

public text v1 · immutable
#2052215 ·published 2011-04-30 11:52 UTC
rendered paste body
include( "shared.lua" )

function hidehud(name)
	for k, v in pairs{"CHudHealth", "CHudBattery"} do
		if name == v then return false end
	end
end
hook.Add("HUDShouldDraw", "hidehud", hidehud)

function DrawAmmoCrateInfo(ent)
	local pos = ent:GetPos()
	
	pos.z = pos.z + 55
	pos = pos:ToScreen()
	
	draw.DrawText("Resupply Crate", "ChatFont", pos.x + 1, pos.y + 1, Color(0, 0, 0, 200), 1)
	draw.DrawText("Resupply Crate", "ChatFont", pos.x, pos.y, Color(255, 255, 255, 255), 1)
end

local function DrawDisplay()
	local tr = LocalPlayer():GetEyeTrace()
	
	if (ValidEntity(tr.Entity) && tr.Entity:GetPos():Distance(LocalPlayer():GetPos()) < 400) then
		if tr.Entity:GetNWBool("ent_ammo_crate") then
			DrawAmmoCrateInfo(tr.Entity)
		end
	end
end

function GM:HUDPaint()
	self.BaseClass:HUDPaint()
	
	DrawDisplay()

	-- Class
	surface.SetTextColor(255, 255, 255, 255)
	surface.SetFont("ChatFont")
	surface.SetTextPos(10, ScrH()-60)
	surface.DrawText(team.GetName( LocalPlayer():Team()))
	
	-- Health
	surface.SetTextColor(255, 255, 255, 255)
	surface.SetFont("ChatFont")
	surface.SetTextPos(10, ScrH()-40)
	surface.DrawText("Health: " .. LocalPlayer():Health())
	
	-- Cash
	surface.SetTextColor(255, 255, 255, 255)
	surface.SetFont("ChatFont")
	surface.SetTextPos(10, ScrH()-20)
	surface.DrawText("Cash: $" .. LocalPlayer():GetNWInt("money"))
	
end