Skip to content

Instantly share code, notes, and snippets.

@AMD-NICK
Created October 9, 2015 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AMD-NICK/1b0584cc1d8856db4ae1 to your computer and use it in GitHub Desktop.
Save AMD-NICK/1b0584cc1d8856db4ae1 to your computer and use it in GitHub Desktop.
Gmod-Best.Ru DarkRP HUD 2015
local ConVars = {}
local HUDWidth
local HUDHeight
local Color = Color
local cvars = cvars
local draw = draw
local GetConVar = GetConVar
local Lerp = Lerp
local localplayer
local pairs = pairs
local SortedPairs = SortedPairs
local string = string
local surface = surface
local table = table
local tostring = tostring
CreateClientConVar("hud_type", 0, true, false)
local function formatNumber(n)
if not n then return "" end
if n >= 1e14 then return tostring(n) end
n = tostring(n)
local sep = sep or ","
local dp = string.find(n, "%.") or #n+1
for i=dp-4, 1, -3 do
n = n:sub(1, i) .. sep .. n:sub(i+1)
end
return n
end
surface.CreateFont("health", { font = "Electrolize", size = 46, weight = 500, antialias = true, shadow = true })
surface.CreateFont("wep_inv", { font = "Electrolize", size = 23, weight = 340, antialias = true, shadow = true })
surface.CreateFont( "Info", { font = "Arial", size = 15, weight = 800, antialias = true })
surface.CreateFont( "Info2", { font = "Arial", size = 17, weight = 800, antialias = true })
surface.CreateFont( "Info3", { font = "Arial", size = 17, weight = 800, antialias = true })
surface.CreateFont( "Ammo", { font = "Arial", size = 65, weight = 800, antialias = true })
local function DrawLine(x,y,w,h,x2,y2,w2,h2)
surface.SetDrawColor(0,0,0,255)
surface.DrawLine(x,ScrH()-y,w,ScrH()-h)
surface.SetDrawColor(61,61,61,255)
surface.DrawLine(x2,ScrH()-y2,w2,ScrH()-h2)
end
local hp = Material("icon16/heart.png")
local ar = Material("icon16/shield.png")
local csh = Material("icon16/money.png")
local sal = Material("icon16/money_add.png")
local jo = Material("icon16/vcard.png")
local hun = Material("icon16/cup.png")
local thr = Material("icon16/water.png")
local ageni = Material("icon16/application.png")
Smooth = 0
Smootha = 0
Smoothxp = 0
local function DrawInfo()
local ply = LocalPlayer()
local health,armor = ply:Health(),ply:Armor()
local salary = formatNumber(ply:getDarkRPVar("salary") or 0)
local job = ply:getDarkRPVar("job") or ""
local money = formatNumber(ply:getDarkRPVar("money") or 0)
local hunger = math.Round(ply:getDarkRPVar( "Energy" ) or 0)
local thirst = math.Round(ply:getDarkRPVar( "Thirst" ) or 0)
local phi = Material("icon16/heart.png")
local armort = " "
local pht = "Здоровый: "
local phc = Color(255, 255, 255, 255)
Smooth = math.Round(math.Approach( Smooth, health, 80 * FrameTime() ) )
Smootha = math.Round(math.Approach( Smootha, armor, 80 * FrameTime() ) )
if health > 90 then pht = "Здоровый: " end
if health < 90 then pht = "Раненный: " end
if health < 30 then phc = Color(255, 0, 0, 255) pht = "Присмерти: " end
if health < 1 then pht = "Мертвый: " end
if GetConVarNumber("hud_type") == 0 then
--Здоровье Броня
draw.RoundedBox(2,11,ScrH()-42,300,20,Color(0,0,0,180))
draw.RoundedBox(2,13,ScrH()-40,math.Clamp(Smooth,0,100)*2.95,15,Color(200,0,0,180))
if armor > 0 then
phi = Material("icon16/shield.png")
armort = " Броня: "..Smootha.."%"
draw.RoundedBox(2,13,ScrH()-40,math.Clamp(Smootha,0,100)*2.95,15,Color(0,0,200,180))
end
draw.DrawText( pht..Smooth.."%"..armort,"Info",36,ScrH()-39,Color(0, 0, 0, 255),TEXT_ALIGN_LEFT)
draw.DrawText( pht..Smooth.."%"..armort,"Info",35,ScrH()-40,phc,TEXT_ALIGN_LEFT)
surface.SetMaterial(phi)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(15,ScrH()-40,16,16)
--Голод
draw.RoundedBox(2,11,ScrH()-63,300,20,Color(0,0,0,180))
draw.RoundedBox(2,13,ScrH()-61,math.Clamp(hunger,0,100)*2.95,15,Color(120,250,0,180))
draw.RoundedBox(2,13,ScrH()-61,math.Clamp(thirst,0,100)*2.95,15,Color(0,0,250,100))
draw.DrawText( "Голод: "..hunger.."% Жажда: "..thirst.."%","Info",36,ScrH()-60,Color(0,0,0,200),TEXT_ALIGN_LEFT)
draw.DrawText( "Голод: "..hunger.."% Жажда: "..thirst.."%","Info",35,ScrH()-61,Color(255,255,255,200),TEXT_ALIGN_LEFT)
surface.SetMaterial(hun)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(15,ScrH()-62,16,16)
--Зарплата
textsize = surface.GetTextSize("Наличные: "..money.." р.")
draw.RoundedBox(2,11,ScrH()-84,300,20,Color(0,0,0,180))
draw.DrawText( "Наличные: "..money.." р. "..salary.." р.","Info",36,ScrH()-81,Color(0,0,0,200),TEXT_ALIGN_LEFT)
draw.DrawText( "Наличные: "..money.." р. "..salary.." р.","Info",35,ScrH()-82,Color(255,255,255,200),TEXT_ALIGN_LEFT)
surface.SetMaterial(csh)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(15,ScrH()-82,16,16)
surface.SetMaterial(sal)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(40+textsize,ScrH()-82,16,16)
--Работа
draw.RoundedBox(2,11,ScrH()-105,300,20,Color(0,0,0,180))
draw.DrawText( "Работа: "..job,"Info",36,ScrH()-102,Color(0,0,0,200),TEXT_ALIGN_LEFT)
draw.DrawText( "Работа: "..job,"Info",35,ScrH()-103,Color(255,255,255,200),TEXT_ALIGN_LEFT)
surface.SetMaterial(jo)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(15,ScrH()-103,16,16)
else -- Хад сверху начало
draw.RoundedBox(2,6,0,298,20,Color(0,0,0,180))
draw.RoundedBox(2,306,0,298,20,Color(0,0,0,180))
draw.RoundedBox(2,606,0,298,20,Color(0,0,0,180))
draw.RoundedBox(2,906,0,298,20,Color(0,0,0,180))
-- Здоровье
draw.RoundedBox(2,8,2,math.Clamp(Smooth,0,100)*2.95,15,Color(200,0,0,180))
if armor > 0 then phi = Material("icon16/shield.png") armort = " Броня: "..Smootha.."%"
draw.RoundedBox(2,8,2,math.Clamp(Smootha,0,100)*2.95,15,Color(0,0,200,180)) end
draw.DrawText( pht..Smooth.."%"..armort,"Info",36,1,Color(0, 0, 0, 255),TEXT_ALIGN_LEFT)
draw.DrawText( pht..Smooth.."%"..armort,"Info",35,2,phc,TEXT_ALIGN_LEFT)
surface.SetMaterial(phi)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(11,2,16,16)
-- Голод
draw.RoundedBox(2,308,2,math.Clamp(hunger,0,100)*2.95,15,Color(120,250,0,180))
draw.RoundedBox(2,308,2,math.Clamp(thirst,0,100)*2.95,15,Color(0,0,250,100))
draw.DrawText( "Голод: "..hunger.."% Жажда: "..thirst.."%","Info",329,1,Color(0,0,0,200),TEXT_ALIGN_LEFT)
draw.DrawText( "Голод: "..hunger.."% Жажда: "..thirst.."%","Info",330,2,Color(255,255,255,200),TEXT_ALIGN_LEFT)
surface.SetMaterial(hun)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(310,2,16,16)
-- Зарплата
textsize = surface.GetTextSize("Наличные: "..money.." р.")
draw.DrawText( "Наличные: "..money.." р. "..salary.." р.","Info",634,1,Color(0,0,0,200),TEXT_ALIGN_LEFT)
draw.DrawText( "Наличные: "..money.." р. "..salary.." р.","Info",635,2,Color(255,255,255,200),TEXT_ALIGN_LEFT)
surface.SetMaterial(csh)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(615,2,16,16)
surface.SetMaterial(sal)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(640+textsize,2,16,16)
-- Работв
draw.DrawText( "Работа: "..job,"Info",939,1,Color(0,0,0,200),TEXT_ALIGN_LEFT)
draw.DrawText( "Работа: "..job,"Info",940,2,Color(255,255,255,200),TEXT_ALIGN_LEFT)
surface.SetMaterial(jo)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(920,2,16,16)
end
end
local PADDING, WIDTH, HALFWIDTH = 10, 16, 6
local BULLET_MATERIAL = Material("csgo_hud/bullet.png")
local LastBullet, SmoothingIn, smooth, Changedbullets, Flyingbullets = 5, false, 0, 0, {}
local function DrawAmmo()
local ply = LocalPlayer()
if !IsValid(ply:GetActiveWeapon()) then return end
local wep = LocalPlayer():GetActiveWeapon();
local clip = wep:Clip1() or 0;
local maxammo = LocalPlayer():GetAmmoCount(ply:GetActiveWeapon():GetPrimaryAmmoType())
local red = clip <= math.ceil(maxammo / 7)
local sw, sh = ScrW() -350, ScrH() -50
if (ply:GetActiveWeapon():GetClass() == "weapon_physcannon") then return false end
if not clip or clip < 0 then return end
local colorc = Color(255,255,255,255)
draw.SimpleText(clip, "health", 200 + sw, 6 + sh, colorc, TEXT_ALIGN_RIGHT)
draw.SimpleText("/ "..maxammo, "wep_inv", 210 + sw, 22 + sh, colorc, TEXT_ALIGN_LEFT)
surface.SetDrawColor(255,255,255,255)
DrawBulletHud( clip, ScrW() - 1085, ScrH() - 27, red, 1.0 )
end
function DrawBulletHud(bullets, x, y, red, scale)
if scale then
WIDTH = 16 * scale
HALFWIDTH = 0.375 * WIDTH
end
surface.SetDrawColor(255,255,255,255)
if LastBullet != bullets then
Changedbullets = math.min(bullets, 5 - (LastBullet - bullets))
if bullets > LastBullet then
Changedbullets = 4
else
if Flyingbullets[1] then
for k, v in pairs(Flyingbullets) do
Flyingbullets[k] = v - 0.05
end
table.insert(Flyingbullets, 0.25)
else
Flyingbullets[1] = 0.25
end
end
if not SmoothingIn then
SmoothingIn = true
end
LastBullet = bullets
end
bullets = math.min(bullets, 5)
--if SmoothingIn then bullets = bullets - 1 end
local xpos = x + 30 + PADDING + 1000
surface.SetMaterial(BULLET_MATERIAL)
if SmoothingIn then
smooth = math.Approach(smooth, 1, 3 * FrameTime())
for i = 1, Changedbullets do
surface.DrawTexturedRect(xpos - (i + 1) * HALFWIDTH + (smooth * HALFWIDTH), y, WIDTH, WIDTH)
end
if bullets == 5 then
surface.SetDrawColor(255, 255,255, smooth * 200)
surface.DrawTexturedRect(xpos - 48 + (smooth * 18), y, WIDTH, WIDTH)
surface.SetDrawColor(255,255,255,255)
else
surface.SetDrawColor(255, 255,255, smooth * 200)
-- surface.DrawTexturedRect(xpos - 48 + (smooth * 18), y, WIDTH, WIDTH)
-- surface.SetDrawColor(178,0,0,255)
end
if smooth == 1 then
smooth, SmoothingIn = 0, false
end
else
for i = 1, bullets do
surface.DrawTexturedRect(xpos - i * HALFWIDTH, y, WIDTH, WIDTH)
end
end
for k, v in pairs (Flyingbullets) do
Flyingbullets[k] = v - FrameTime()
if v < 0 then Flyingbullets[k] = nil continue end
surface.DrawTexturedRectRotated(xpos + HALFWIDTH * k, y + HALFWIDTH + k * 3, WIDTH, WIDTH, k * -15)
end
for i = 5, 1, -1 do
if Flyingbullets[i] and Flyingbullets[i] < 0.25 - i * 0.05 then
Flyingbullets[i + 1] = Flyingbullets[i]
Flyingbullets[i] = nil
end
end
end
local wanted = Material("icon16/star.png")
local lok = Material("icon16/building_delete.png")
local Page = Material("icon16/page_white_text.png")
local Admin = Material("icon16/shield.png")
CreateConVar("DarkRP_LockDown", 0, {FCVAR_REPLICATED, FCVAR_SERVER_CAN_EXECUTE})
local function DrawInportantInfo()
if GetConVarNumber("hud_type") == 0 then
l = - 2
z = 0
// Wanted
if LocalPlayer():isWanted() then
draw.RoundedBox(2,315,ScrH()-105,41,41,Color(math.sin( CurTime() * 7 ) * 75,0,0,180))
surface.SetMaterial(wanted)
surface.SetDrawColor( math.sin( CurTime() * 5 ) * 255,math.sin( CurTime() * 5 ) * 255,math.sin( CurTime() * 5 ) * 255 )
surface.DrawTexturedRect(320,ScrH()-101,32,32)
else
draw.RoundedBox(2,315,ScrH()-105,41,41,Color(0,0,0,100))
surface.SetMaterial(wanted)
surface.SetDrawColor(0,0,0,100)
surface.DrawTexturedRect(320,ScrH()-101,32,32)
end
// LockDown
if util.tobool(GetConVarNumber("DarkRP_LockDown")) then
draw.RoundedBox(2,11,ScrH()-124+l,300,20,Color(math.sin( CurTime() * 7 ) * 75,0,0,180))
draw.DrawText("Комендантский час идите домой!","Info",36,ScrH()-123+l,Color(0, 0, 0, 255),TEXT_ALIGN_LEFT)
draw.DrawText("Комендантский час идите домой!","Info",35,ScrH()-122+l,Color(255, 0, 0, 255),TEXT_ALIGN_LEFT)
surface.SetMaterial(lok)
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(15,ScrH()-122+l,16,16)
z = - 20
end
// Gun Licence
if LocalPlayer():getDarkRPVar("HasGunlicense") or LocalPlayer():IsCP() then
draw.RoundedBox(2,315,ScrH()-63,41,41,Color(0,0,0,180))
surface.SetMaterial(Page)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(320,ScrH()-57,32,32)
else
draw.RoundedBox(2,315,ScrH()-63,41,41,Color(0,0,0,100))
surface.SetMaterial(Page)
surface.SetDrawColor(0,0,0,100)
surface.DrawTexturedRect(320,ScrH()-57,32,32)
end
else
// LockDown
if util.tobool(GetConVarNumber("DarkRP_LockDown")) then
textsize = surface.GetTextSize("Комендантский час идите домой!") / 2 + 30
draw.RoundedBox(2,5,22,ScrW() - 10,20,Color(math.sin( CurTime() * 7 ) * 75,0,0,180))
draw.DrawText("Комендантский час идите домой!","Info",ScrW()/2,23,Color(0, 0, 0, 255),TEXT_ALIGN_CENTER)
draw.DrawText("Комендантский час идите домой!","Info",ScrW()/2,24,Color(255, 0, 0, 255),TEXT_ALIGN_CENTER)
surface.SetMaterial(lok)
surface.SetDrawColor(color_white)
surface.DrawTexturedRect(ScrW()/2 - textsize ,24,16,16)
end
end
local ppm = LocalPlayer():Health() / 100
local tab =
{
[ "$pp_colour_addr" ] = 0,
[ "$pp_colour_addg" ] = 0,
[ "$pp_colour_addb" ] = 0,
[ "$pp_colour_brightness" ] = 0,
[ "$pp_colour_contrast" ] = 1,
[ "$pp_colour_colour" ] = ppm,
[ "$pp_colour_mulr" ] = 0,
[ "$pp_colour_mulg" ] = 0,
[ "$pp_colour_mulb" ] = 0
}
if LocalPlayer():Health() <= 60 then
DrawColorModify( tab )
end
if LocalPlayer():Health() <= 30 then
DrawMotionBlur( 0.4, 0.8, 0.01 )
end
end
local function Agenda()
local DrawAgenda, AgendaManager = DarkRPAgendas[localplayer:Team()], localplayer:Team()
if not DrawAgenda then
for k,v in pairs(DarkRPAgendas) do
if table.HasValue(v.Listeners or {}, localplayer:Team()) then
DrawAgenda, AgendaManager = DarkRPAgendas[k], k
break
end
end
end
if DrawAgenda then
draw.RoundedBox(0,11, 50, 25,20,Color(0,0,0,200))
draw.RoundedBox(0,40, 50, 350,20,Color(0,0,0,150))
draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 50, 50, color_white)
surface.SetMaterial(ageni)
surface.SetDrawColor(255,255,255,200)
surface.DrawTexturedRect(15,52,16,16)
local AgendaText = {}
for k,v in pairs(team.GetPlayers(AgendaManager)) do
if not v.DarkRPVars then continue end
table.insert(AgendaText, v:getDarkRPVar("agenda"))
end
local text = table.concat(AgendaText, "\n")
text = text:gsub("//", "\n"):gsub("\\n", "\n")
text = GAMEMODE:TextWrap(text, "DarkRPHUD1", 250)
draw.DrawText(text, "DarkRPHUD1", 43, 76, Color(0,0,0,200),0)
draw.DrawText(text, "DarkRPHUD1", 42, 75, Color(255,255,255,255),0)
end
end
local Arrested = function() end
usermessage.Hook("GotArrested", function(msg)
local StartArrested = CurTime()
local ArrestedUntil = msg:ReadFloat()
Arrested = function()
if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
local aresttimer = math.ceil(ArrestedUntil - (CurTime() - StartArrested))
local arestcl = Color(255,255,255,255)
if aresttimer < 60 then arestcl = Color(0,255,0,255) end
draw.RoundedBox(0,10,50,300,50,Color(0,0,0,200))
draw.RoundedBox(0,15,55,290,40,Color(math.sin( CurTime() * 2 ) * 75,0,0,200))
draw.DrawText( "Вы в тюрьме!", "Info", 160, 60, Color(255,255,255,255), TEXT_ALIGN_CENTER)
draw.DrawText( "Вас освободят через: " .. aresttimer , "Info", 160, 75, arestcl, TEXT_ALIGN_CENTER)
elseif not localplayer:getDarkRPVar("Arrested") then
Arrested = function() end
end
end
end)
local AdminTell = function() end
usermessage.Hook("AdminTell", function(msg)
local Message = msg:ReadString()
AdminTell = function()
draw.RoundedBox(4, 10, 10, ScrW() - 20, 100, Color(0, 0, 0, 200))
surface.PlaySound( "playerup.mp3" )
draw.DrawText(Message, "GModToolName", ScrW() / 2 + 10, 10, Color(255, 255, 255, 255), 1)
draw.DrawText("", "ChatFont", ScrW() / 2 + 10, 80, Color(200, 30, 30, 10), 1)
end
timer.Simple(7, function()
AdminTell = function() end
end)
end)
local Promote = function() end
usermessage.Hook("Promote", function(data)
local name = data:ReadString()
local reas = data:ReadString()
local wname = data:ReadString()
Promote = function()
draw.RoundedBox(0,ScrW() - 260 ,70,250,200,Color(0,0,0,200))
draw.RoundedBox(0,ScrW() - 255 ,75,240,65,Color(0,100,250,200))
draw.DrawText( "Внимание!", "Info32", ScrW() - 135, 90, Color(255,255,255,255), TEXT_ALIGN_CENTER)
draw.DrawText( "Активный ордер на" , "Info25", ScrW() - 135, 150, Color(255,255,255,255), TEXT_ALIGN_CENTER)
draw.DrawText( "обыск "..name.."'a" , "Info25", ScrW() - 135, 180, Color(255,255,255,255), TEXT_ALIGN_CENTER)
draw.DrawText( "Ордер запросил: "..wname , "Info", ScrW() - 250, 210, Color(255,255,255,255), TEXT_ALIGN_LEFT)
draw.DrawText( "Причина: "..reas , "Info", ScrW() - 250, 225, Color(255,255,255,255), TEXT_ALIGN_LEFT)
end
timer.Simple(12, function()
Promote = function() end
end)
end)
local function DrawHUD()
localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
if not IsValid(localplayer) then return end
DrawInfo()
DrawAmmo()
DrawInportantInfo()
Agenda()
Arrested()
AdminTell()
Promote()
end
local function DrawPlayerInfo(ply)
local pos = ply:EyePos()
local health = ply:Health()
healthinfo = "Здоровый"
if health > 90 then
healthinfo = "Здоровый"
end
if health < 90 then
healthinfo = "Раненный"
end
if health < 30 then
healthinfo = "Присмерти"
end
healthcolor = Color(100,255,0,255)
if health > 90 then
healthcolor = Color(12,255,0,255)
end
if health < 90 then
healthcolor = Color(200,255,0,255)
end
if health < 50 then
healthcolor = Color(255,100,0,255)
end
if health < 30 then
healthcolor = Color(255,0,0,255)
end
pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
pos = pos:ToScreen()
pos.y = pos.y - 50 -- Move the text up a few pixels to compensate for the height of the text
plynick = surface.GetTextSize( ply:Nick() )
local clan = ""
if ply:IsGN() then clan = "[".. ply:GetNWString("Gang") .."] " end
lc = Color( math.sin( CurTime() * 5 ) * 255,math.sin( CurTime() * 5 ) * 255,0 )
plyclans = surface.GetTextSize( clan )
if not ply:getDarkRPVar("wanted") then
draw.DrawText(clan .. ply:Nick(), "Info3", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)
draw.DrawText(clan .. ply:Nick(), "Info3", pos.x, pos.y, team.GetColor(ply:Team()), 1)
draw.DrawText(healthinfo, "Info3", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1)
draw.DrawText(healthinfo, "Info3", pos.x, pos.y + 20, healthcolor, 1)
else
draw.DrawText(clan .. ply:Nick(), "Info3", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1)
draw.DrawText(clan .. ply:Nick(), "Info3", pos.x, pos.y, team.GetColor(ply:Team()), 1)
draw.DrawText("В розыске!", "Info3", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1)
draw.DrawText("В розыске!", "Info3", pos.x, pos.y + 20, lc, 1)
end
if ply:getDarkRPVar("HasGunlicense") and not ply:getDarkRPVar("wanted") then
surface.SetMaterial(Page)
surface.SetDrawColor(255,255,255,255)
surface.DrawTexturedRect(pos.x + plynick + plyclans, pos.y, 16, 16)
end
end
local function DrawEntityDisplay()
local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_EntityDisplay")
if shouldDraw == false then return end
local shootPos = localplayer:GetShootPos()
local aimVec = localplayer:GetAimVector()
for k, ply in pairs(player.GetAll()) do
if not ply:Alive() then continue end
local hisPos = ply:GetShootPos()
if GAMEMODE.Config.globalshow and ply ~= localplayer then
DrawPlayerInfo(ply)
-- Draw when you're (almost) looking at him
elseif not GAMEMODE.Config.globalshow and hisPos:Distance(shootPos) < 120 then
local pos = hisPos - shootPos
local unitPos = pos:GetNormalized()
if unitPos:Dot(aimVec) > 0.95 then
local trace = util.QuickTrace(shootPos, pos, localplayer)
if trace.Hit and trace.Entity ~= ply then return end
DrawPlayerInfo(ply)
end
end
end
local tr = localplayer:GetEyeTrace()
if IsValid(tr.Entity) and tr.Entity:IsOwnable() and tr.Entity:GetPos():Distance(localplayer:GetPos()) < 120 then
tr.Entity:DrawOwnableInfo()
end
end
function GM:HUDPaint()
DrawHUD()
DrawEntityDisplay()
self.BaseClass:HUDPaint()
end
function hidehud(name)
for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo", "CHudSecondaryAmmo"}) do
if name == v then return false end
end
end
hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment