Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PHDayZ = PHDayZ or {}
- local CurDeathTime = 0
- net.Receive( "net_DeathMessage", function( len )
- DeathMessage = net.ReadString()
- surface.PlaySound( "music/death.wav" )
- DeathMessage2 = ""
- local ply = LocalPlayer()
- if ply.IsVIP and ply:IsVIP() then
- CurDeathTime = (CurTime()+PHDayZ.vipdeathtime)
- else
- CurDeathTime = (CurTime()+PHDayZ.deathtime)
- end
- end)
- local blur = Material("pp/blurscreen")
- function drawBlurAt(x, y, w, h, amount, passes, reverse)
- -- Intensity of the blur.
- amount = amount or 5
- surface.SetMaterial(blur)
- surface.SetDrawColor(255, 255, 255)
- local scrW, scrH = ScrW(), ScrH()
- local x2, y2 = x / scrW, y / scrH
- local w2, h2 = (x + w) / scrW, (y + h) / scrH
- for i = -(passes or 0.2), 1, 0.2 do
- if reverse then
- blur:SetFloat("$blur", i*-1 * amount)
- else
- blur:SetFloat("$blur", i * amount)
- end
- blur:Recompute()
- render.UpdateScreenEffectTexture()
- surface.DrawTexturedRectUV(x, y, w, h, x2, y2, w2, h2)
- end
- end
- function Pulsate(c) --used for flashing colors
- return (math.abs(math.sin(CurTime()*c)))
- end
- function Fluctuate(c) --used for flashing colors
- return (math.cos(CurTime()*c)+1)/2
- end
- net.Receive("PHDayZ_ServerErrors", function( len )
- PHDayZ_CriticalErrors = net.ReadTable()
- end)
- local soundplaying = false
- function ShowSZPopup()
- local SW, SH = ScrW(),ScrH()
- if LocalPlayer():GetSafeZone() or LocalPlayer():GetSafeZoneEdge() then
- local mcount = LocalPlayer():GetItemAmount("item_money")
- local ccount = LocalPlayer():GetItemAmount("item_credits")
- draw.RoundedBox(4,SW/2-150,0,300,40,Color( 0,0, 0, 155 ))
- draw.DrawText("$"..mcount, "Cyb_HudTEXT", SW/2-100, 8, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER)
- draw.DrawText("XP:"..math.Round(LocalPlayer():GetXP()), "Cyb_HudTEXT", SW/2+100, 8, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER)
- draw.DrawText("¢"..ccount, "Cyb_HudTEXT", SW/2, 8, Color(255, 255, 255, 255),TEXT_ALIGN_CENTER)
- end
- local TagTime = LocalPlayer():GetTagTime()
- if GUI_CombatMusic == 1 then
- if LocalPlayer():GetTagTime() > CurTime() then
- if !soundplaying then
- soundplaying = true
- surface.PlaySound("music/combat3.wav")
- timer.Simple(60, function() soundplaying = false end)
- end
- end
- end
- if IsValid(SZPanel) then
- if SZPanel.Moving then return end
- local DoMove = false
- if LocalPlayer():GetTagTime() < CurTime() and SZPanel.WasTagged then
- DoMove = true
- elseif LocalPlayer():GetSafeZone() and SZPanel.Edge then
- DoMove = true
- elseif LocalPlayer():GetSafeZoneEdge() and !SZPanel.Edge then
- DoMove = true
- elseif ( !LocalPlayer():GetSafeZone() and !LocalPlayer():GetSafeZoneEdge() ) or ( LocalPlayer():GetTagTime() > CurTime() and !SZPanel.WasTagged ) then
- DoMove = true
- elseif GUI_ShowSZHint != 1 then
- DoMove = true
- end
- if DoMove then
- SZPanel:MoveTo(ScrW(), 200, 1, 0.1, -1, function(anim, pnl)
- SZPanel:Remove()
- end)
- SZPanel.Moving = true
- end
- end
- if ( !LocalPlayer():GetSafeZone() and !LocalPlayer():GetSafeZoneEdge() ) or IsValid(SZPanel) then return end
- if GUI_ShowSZHint != 1 then return end
- SZPanel = vgui.Create("DPanel")
- SZPanel:SetSize(200, 55)
- SZPanel:SetPos(ScrW(), 200)
- SZPanel.Edge = LocalPlayer():GetSafeZoneEdge()
- SZPanel.WasTagged = ( LocalPlayer():GetTagTime() > CurTime() )
- local text = (LocalPlayer():GetSafeZone() and LANG.GetTranslation("safezone")) or (LocalPlayer():GetSafeZoneEdge() and LANG.GetTranslation("safezoneedge")) or ""
- local infotext = ( LocalPlayer():GetTagTime() > CurTime() ) and "Vulnerable to Damage" or (LocalPlayer():GetSafeZone() and LANG.GetTranslation("safezonehint")) or (LocalPlayer():GetSafeZoneEdge() and LANG.GetTranslation("safezonehint")) or LANG.GetTranslation("safezonevuln")
- local color = Color(255, 255, 255, 255)
- if ( LocalPlayer():GetTagTime() > CurTime() ) then
- color = Color(255, 0, 0, 255)
- end
- SZPanel.Paint = function(self, w, h)
- local szcountdown = ""
- if self.WasTagged then
- szcountdown = " ("..math.Round(LocalPlayer():GetTagTime() - CurTime()).."s)"
- if math.Round(LocalPlayer():GetTagTime() - CurTime()) <= 0 then
- szcountdown = ""
- end
- end
- draw.RoundedBox(4, 0, 0, w, h, Color(10, 10, 10, 200))
- draw.DrawText(text, "char_title24", w/2, 8, Color(255, 255, 255, 255), TEXT_ALIGN_CENTER)
- draw.DrawText(infotext..szcountdown, "char_title16", w/2, 28, color, TEXT_ALIGN_CENTER)
- end
- SZPanel:MoveTo(ScrW()-200, 200, 1, 0.1, -1, function() if IsValid(SZPanel) then SZPanel.Moving = false end end)
- --timer.Simple(10, function() if IsValid(SZPanel) then SZPanel:Remove() end end)
- end
- PHDayZ_CriticalErrors = PHDayZ_CriticalErrors or {}
- local function ShowSetupErrors()
- if #PHDayZ_CriticalErrors < 1 then return end
- local w = ScrW()
- local h = 200
- local padding = ScrW()/2-w/2
- local y = ScrH()/2
- local color = Color(Pulsate(1)*255, 0, 0, 255)
- draw.RoundedBoxEx(4, padding-1, y-h/2, w, h, Color(10, 10, 10, 200), false, false, false, false)
- draw.SimpleTextOutlined( "THIS SERVER HAS CRITICAL GAMEMODE SETUP ERRORS (SEE ERROR FAQ)", "SafeZone_NAME", padding + w/2 - 4, y-60, color, 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- local i = 0
- for k, v in pairs(PHDayZ_CriticalErrors) do
- draw.SimpleTextOutlined( v, "tab_title", padding + w/2 - 4, y+i, Color(255,0,0,255), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- i = i + 30
- end
- end
- local CssContent = false
- local Hl2EP2Content = false
- local DayZContent = false
- local function CheckMissingContent()
- if !CssContent then
- if IsMounted('cstrike') then CssContent = true elseif file.Exists("models/props/de_piranesi/pi_sundial.mdl", "GAME") then CssContent = true end
- end
- if !Hl2EP2Content then
- if IsMounted('ep2') then Hl2EP2Content = true elseif file.Exists("models/antlion_worker.mdl", "GAME") then Hl2EP2Content = true end
- end
- if !DayZContent then
- if file.Exists("models/zed/malezed_04.mdl", "GAME") then DayZContent = true end
- end
- if CssContent and Hl2EP2Content and DayZContent then timer.Destroy("ContentChecker") end
- end
- timer.Create("ContentChecker", 5, 0, CheckMissingContent)
- local function ShowMissingContent()
- --if #PHDayZ_MissingContent < 1 then return end
- --if IsMounted('ep2') then return end
- if GUI_ShowMissingContent == 0 then return end
- if CssContent and Hl2EP2Content and DayZContent then return end
- local w = 538
- local h = 170
- local padding = 0
- local tpad = 20
- local y = 175
- local color = Color( 140, 50, 50, 255 )
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, Color(10, 10, 10, 150), false, true, false, true)
- draw.SimpleTextOutlined( "YOUR CLIENT IS MISSING CONTENT!", "SafeZone_NAME", padding + w/2, y-70, Color( 255, 0, 0, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- if !CssContent then
- draw.SimpleTextOutlined( "Content: 'CSS' not found!", "Cyb_HudTEXT", tpad, y-40, Color( 255, 255, 255, 255 ), 0, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- if !Hl2EP2Content then
- draw.SimpleTextOutlined( "Content: 'HL2:Episode 2' not found!", "Cyb_HudTEXT", tpad, y-20, Color( 255, 255, 255, 255 ), 0, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- if !DayZContent then
- draw.SimpleTextOutlined( "Content: 'GMod DayZ' not found!", "Cyb_HudTEXT", tpad, y, Color( 255, 255, 255, 255 ), 0, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- draw.SimpleTextOutlined( "ENJOY ERRORS/MISSING TEXTURES!", "SafeZone_NAME", padding + w/2, y+40, Color( 255, 0, 0, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- draw.SimpleTextOutlined( "No, seriously. Get the content from gmoddayz.net", "Cyb_HudTEXT", tpad, y+70, Color( 255, 255, 255, 255 ), 0, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- local function GetHungerValue()
- return math.Clamp(LocalPlayer():GetHunger(), 0, 1000)
- end
- local function GetThirstValue()
- return math.Clamp(LocalPlayer():GetThirst(), 0, 1000)
- end
- net.Receive("net_DeathMessage2", function( len )
- DeathMessage2 = "Any key to continue..."
- end)
- function GM:DrawDeathNotice(x, y)
- return
- end
- function HideThings( name )
- if (name == "CHudDamageIndicator" ) then
- return false
- end
- end
- hook.Add( "HUDShouldDraw", "HideThings", HideThings )
- function GM:HUDShouldDraw(Name)
- if IsValid(LocalPlayer()) and LocalPlayer():GetSafeZone() && Name == "CHudWeaponSelection" then
- return false
- end
- return true
- end
- local grad = Material("gui/gradient")
- local tagmat = Material("gui/icon_cyb_64_red.png")
- local edgemat = Material("gui/icon_cyb_64_orange.png")
- local safemat = Material("gui/icon_cyb_64_blue.png")
- ProcessName = ProcessName or "N/A"
- ProcessTime = ProcessTime or 0
- ProcessItem = ProcessItem or ""
- ProcessRunning = ProcessRunning or false
- local ProcessStartTime = RealTime()
- function DoProcessBar()
- ProcessName = net.ReadString()
- ProcessAmount = net.ReadInt(16)
- ProcessTime = net.ReadFloat()
- ProcessItem = net.ReadString()
- ProcessItem = ProcessItem or "item_wood"
- ProcessRunning = true
- ProcessStartTime = RealTime()
- MakeProcessBar()
- end
- net.Receive("DoProcessBar", DoProcessBar)
- function MakeProcessBar()
- if !ProcessRunning then return end
- local name, amount, item, time = ProcessName, ProcessAmount, ProcessItem, ProcessTime
- local NewPanel = false
- if !IsValid(ProcessFrame) then
- NewPanel = true
- ProcessFrame = vgui.Create("DPanel")
- end
- timer.Create("removeprocessbar", time + 3, 1, function()
- if IsValid(ProcessFrame) then
- ProcessFrame:MoveTo( ScrW()/2 - 250, -85, 0.5, 0, -1, function() if !ProcessFrame.Moving then ProcessFrame:Remove() end end )
- end
- end)
- local makecustomicon = false
- if !GAMEMODE.DayZ_Items[item] then
- ProcessFrame.Status = name
- makecustomicon = true
- else
- ProcessFrame.Status = name.." "..GAMEMODE.DayZ_Items[item].Name.." x"..amount
- end
- ProcessFrame:SetSize( 500, 85 )
- if NewPanel then
- ProcessFrame:SetPos( ScrW()/2 - 250, -85 )
- ProcessFrame.WantsMove = true
- end
- ProcessFrame:MoveTo( ScrW()/2 - 250, 60, 0.5, 0, -1, function() ProcessFrame.Moving = false end )
- ProcessFrame.Moving = true
- ProcessFrame.Paint = function(self, w, h)
- draw.RoundedBox(4, 0, 0, w, h, Color( 0, 0, 0, 150 ))
- draw.RoundedBoxEx(4,5,5,75,75,Color( 0, 0, 0, 50 ), true, true, true, true)
- draw.RoundedBoxEx(4,6,6,75-2,75-2,Color( 255, 255, 255, 10 ), true, true, true, true)
- draw.RoundedBoxEx(4,7,7,75-4,75-4,Color( 60, 60, 60, 255 ), true, true, true, true)
- if LocalPlayer():GetItemAmount(item) > 0 then
- draw.DrawText( "x"..LocalPlayer():GetItemAmount(item), "Cyb_Inv_Label", 75, 65, Color(200, 200, 200, 255), TEXT_ALIGN_RIGHT )
- end
- end
- if IsValid(ProcessFrame.ProcessIconPanel) then -- Remove and re-create.
- ProcessFrame.ProcessIconPanel:Remove()
- end
- if makecustomicon then
- ProcessFrame.ProcessIconPanel = vgui.Create("DPanel", ProcessFrame)
- ProcessFrame.ProcessIconPanel.Paint = function(self, w, h)
- draw.RoundedBoxEx(4,0,0,w,h,Color( 0, 0, 0, 50 ), true, true, true, true)
- draw.RoundedBoxEx(4,1,1,w-2,h-2,Color( 255, 255, 255, 10 ), true, true, true, true)
- draw.RoundedBoxEx(4,2,2,w-4,h-4,Color( 60, 60, 60, 255 ), true, true, true, true)
- end
- ProcessFrame.ProcessIconPanel:SetSize(75, 75)
- ProcessFrame.ProcessIcon = vgui.Create("DModelPanel", ProcessFrame.ProcessIconPanel)
- ProcessFrame.ProcessIcon:SetPos(0, 0)
- ProcessFrame.ProcessIcon:SetSize(80, 80)
- ProcessFrame.ProcessIcon:SetModel( item )
- local PaintModel = ProcessFrame.ProcessIcon.Paint
- ProcessFrame.ProcessIcon.LayoutEntity = function() end
- ProcessFrame.ProcessIcon:SetDrawOnTop(false)
- local mn, mx = ProcessFrame.ProcessIcon:GetEntity():GetRenderBounds();
- local size = 0;
- size = math.max(size, math.abs(mn.x) + math.abs(mx.x));
- size = math.max(size, math.abs(mn.y) + math.abs(mx.y));
- size = math.max(size, math.abs(mn.z) + math.abs(mx.z));
- ProcessFrame.ProcessIcon:SetFOV(45);
- ProcessFrame.ProcessIcon:SetCamPos(Vector(size, size, size));
- ProcessFrame.ProcessIcon:SetLookAt((mn + mx) * 0.5);
- --ProcessFrame.ProcessIcon:GetEntity():SetAngles( Angle(0,0,0) )
- function ProcessFrame.ProcessIcon:Paint(w, h)
- local x2, y2 = self:GetParent():LocalToScreen( 0, 0 )
- local w2, h2 = self:GetParent():GetSize()
- render.SetScissorRect( x2, y2, x2 + w2, y2 + h2, true )
- PaintModel( self, w, h )
- render.SetScissorRect( 0, 0, 0, 0, false )
- end
- else
- ProcessFrame.ProcessIconPanel, ProcessFrame.ProcessIcon = DZ_MakeIcon( item, 0, ProcessFrame, nil, nil, 75, 75, false, true, false )
- end
- ProcessFrame.ProcessIconPanel:SetPos(5, 5)
- if !IsValid(ProcessFrame.ProcessBar) then
- ProcessFrame.ProcessBar = vgui.Create("DPanel", ProcessFrame)
- end
- ProcessFrame.ProcessBar:SetSize( 400, 25 )
- ProcessFrame.ProcessBar:SetPos( 90, 30 )
- local width = 0
- local curtime = RealTime() + time
- ProcessFrame.ProcessBar.Paint = function(self, w, h)
- draw.RoundedBox(0, 0, 0, w, h, Color( 50, 50, 50, 255 ))
- if ProcessRunning and width < 401 then
- if time < 1 then
- width = ( ( RealTime() - ProcessStartTime ) * (time*4) ) * 400
- else
- width = ( ( RealTime() - ProcessStartTime ) / time ) * 400
- end
- local timeleft = math.Round( curtime - RealTime() )
- if !GAMEMODE.DayZ_Items[item] then
- ProcessFrame.Status = name.." ( ".. timeleft .."s )"
- else
- ProcessFrame.Status = name.." "..GAMEMODE.DayZ_Items[item].Name.." x"..amount.." ( ".. timeleft .."s )"
- end
- end
- surface.SetDrawColor( 30, 30, 30, 150 )
- surface.DrawRect( 0, 0, width, h )
- if width >= 400 then
- ProcessFrame.Status = "Finished!"
- end
- draw.DrawText( ProcessFrame.Status, "Cyb_Inv_Label", w/2, h-18, Color(200,200,200,255), TEXT_ALIGN_CENTER )
- end
- end
- local red, green = 255, 0
- --Stop progress bar
- function StopProcessBar()
- ProcessRunning = false
- if IsValid(ProcessFrame) then
- ProcessFrame.Status = "Cancelled!"
- timer.Simple(3, function()
- if IsValid(ProcessFrame) then
- ProcessFrame:MoveTo( ScrW()/2 - 250, -85, 0.5, 0, -1, function() if !ProcessFrame.Moving then ProcessFrame:Remove() end end )
- end
- end)
- end
- red, green = 255, 0
- end
- net.Receive("StopProcessBar", StopProcessBar)
- local function DrawProcessBar()
- if ProcessRunning then
- local wid = ScrW() / 3
- local hei = ScrH() / 30
- surface.SetDrawColor( 30, 30, 30, 150 )
- surface.DrawRect( ScrW() * 0.5 - wid * 0.5, ScrH() / 30, wid, hei )
- local width = ( ( RealTime() - ProcessStartTime ) / ProcessTime ) * wid
- if width >= wid then UpdateAllTabs() StopProcessBar() return end -- end
- surface.SetDrawColor( red, green, 0, 255)
- red = 255/(width/150)
- green = (width/3)
- surface.DrawRect( ScrW() * 0.5 - wid * 0.5, ScrH() / 30, width, hei )
- surface.SetDrawColor( 27, 167, 219,255 )
- surface.DrawOutlinedRect( ScrW() * 0.5 - wid * 0.5, ScrH() / 30, wid, hei )
- draw.SimpleText( ProcessName, "Cyb_HudTEXT", ScrW() * 0.5, hei * 1.5, Color( 255, 255, 255, 255 ), 1, 1 )
- end
- end
- function hidehud(name)
- for k, v in pairs({"CHudHealth", "CHudBattery", "CHudAmmo"})do
- if name == v then return false end
- end
- end
- hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud)
- local ButtonMaterial = Material("cyb_mat/cyb_keybut.png")
- local ButtonPanel
- function GM:HUDDrawTargetID()
- local tr = LocalPlayer():GetEyeTrace()
- hook.Call("DZ_HudTargetID", GAMEMODE, tr)
- if IsValid(tr.Entity) and (tr.Entity:GetClass() == "prop_physics") and (tr.Entity:Health() > 0) then
- if PHDayZ.AllowPropDamage then
- local ent = tr.Entity
- local maxhp, hp, pos = ent:GetMaxHealth(), ent:Health(), ent:GetPos()
- local percentCalc = 255 * (hp / maxhp)
- draw.SimpleTextOutlined(tostring(hp) .." / " ..tostring(maxhp), "TargetIDSmall", ScrW()/2, ScrH()/2-50, Color(255-percentCalc,percentCalc,0,255), 1, 1, 1, Color(0,0,0,255))
- end
- end
- if IsValid(tr.Entity) and tr.Entity:GetClass() == "base_item" and LocalPlayer():GetPos():Distance(tr.Entity:GetPos()) < 100 then
- local class = tr.Entity:GetItem()
- local tab = { tr.Entity }
- halo.Add( tab, Color( 255, 255, 255 ), 5, 5, 2 )
- if LocalPlayer():KeyDown(IN_USE) then
- if IsValid(ButtonPanel) then return end
- ButtonPanel = vgui.Create("DPanel")
- ButtonPanel.Paint = function(self, w, h)
- draw.RoundedBox( 4, 0, 0, w, h, Color(0,0,0,220) )
- end
- local i = 0
- if GAMEMODE.DayZ_Items[class].CanIgnite and LocalPlayer():HasItem("item_firestarter") and !tr.Entity:IsOnFire() then
- ButtonPanel.Ignite = vgui.Create("DButton", ButtonPanel)
- ButtonPanel.Ignite:Dock(TOP)
- ButtonPanel.Ignite:SetTall(15)
- ButtonPanel.Ignite:SetText("")
- ButtonPanel.Ignite.Paint = function(self, w, h)
- local boxcolor = Color(0,0,0,255)
- local textcolor = Color(255,255,255,255)
- if self:IsHovered() then
- boxcolor = Color(255,255,255,255)
- textcolor = Color(0,0,0,255)
- end
- draw.RoundedBox( 0, 0, 0, w, h, boxcolor )
- draw.DrawText( "Set on Fire", "Cyb_Inv_Label", w/2, 0, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- end
- ButtonPanel.Ignite.DoClick = function(self)
- net.Start("base_ItemAction")
- net.WriteUInt(4, 4)
- net.WriteUInt(tr.Entity:EntIndex() , 32)
- net.SendToServer()
- end
- i = i + 15
- end
- if GAMEMODE.DayZ_Items[class].Weapon or GAMEMODE.DayZ_Items[class].Body or GAMEMODE.DayZ_Items[class].Pants or GAMEMODE.DayZ_Items[class].Shoes or GAMEMODE.DayZ_Items[class].BackPack or GAMEMODE.DayZ_Items[class].Hat then
- ButtonPanel.Equip = vgui.Create("DButton", ButtonPanel)
- ButtonPanel.Equip:Dock(TOP)
- ButtonPanel.Equip:SetTall(15)
- ButtonPanel.Equip:SetText("")
- ButtonPanel.Equip.Paint = function(self, w, h)
- local boxcolor = Color(0,0,0,255)
- local textcolor = Color(255,255,255,255)
- if self:IsHovered() then
- boxcolor = Color(255,255,255,255)
- textcolor = Color(0,0,0,255)
- end
- draw.RoundedBox( 0, 0, 0, w, h, boxcolor )
- draw.DrawText( "Equip", "Cyb_Inv_Label", w/2, 0, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- end
- ButtonPanel.Equip.DoClick = function(self)
- net.Start("base_ItemAction")
- net.WriteUInt(5, 4)
- net.WriteUInt(tr.Entity:EntIndex(), 32)
- net.SendToServer()
- end
- i = i + 15
- end
- if GAMEMODE.DayZ_Items[class].CustomFunc and GAMEMODE.DayZ_Items[class].CustomFuncName then
- ButtonPanel.CustomFunc = vgui.Create("DButton", ButtonPanel)
- ButtonPanel.CustomFunc:Dock(TOP)
- ButtonPanel.CustomFunc:SetTall(15)
- ButtonPanel.CustomFunc:SetText("")
- ButtonPanel.CustomFunc.Paint = function(self, w, h)
- local boxcolor = Color(0,0,0,255)
- local textcolor = Color(255,255,255,255)
- if self:IsHovered() then
- boxcolor = Color(255,255,255,255)
- textcolor = Color(0,0,0,255)
- end
- draw.RoundedBox( 0, 0, 0, w, h, boxcolor )
- draw.DrawText( GAMEMODE.DayZ_Items[class].CustomFuncName, "Cyb_Inv_Label", w/2, 0, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- end
- ButtonPanel.CustomFunc.DoClick = function(self)
- net.Start("base_ItemAction")
- net.WriteUInt(3, 4)
- net.WriteUInt(tr.Entity:EntIndex() , 32)
- net.SendToServer()
- end
- i = i + 15
- end
- if GAMEMODE.DayZ_Items[class].Function and !GAMEMODE.DayZ_Items[class].NoConsumeFromFloor then
- ButtonPanel.Consume = vgui.Create("DButton", ButtonPanel)
- ButtonPanel.Consume:Dock(TOP)
- ButtonPanel.Consume:SetTall(15)
- ButtonPanel.Consume:SetText("")
- ButtonPanel.Consume.Paint = function(self, w, h)
- local boxcolor = Color(0,0,0,255)
- local textcolor = Color(255,255,255,255)
- if self:IsHovered() then
- boxcolor = Color(255,255,255,255)
- textcolor = Color(0,0,0,255)
- end
- draw.RoundedBox( 0, 0, 0, w, h, boxcolor )
- draw.DrawText( "Use", "Cyb_Inv_Label", w/2, 0, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- end
- ButtonPanel.Consume.DoClick = function(self)
- net.Start("base_ItemAction")
- net.WriteUInt(1, 4)
- net.WriteUInt(tr.Entity:EntIndex() , 32)
- net.WriteUInt(3, 4)
- net.SendToServer()
- end
- i = i + 15
- end
- if GAMEMODE.DayZ_Items[class].EatFunction and !GAMEMODE.DayZ_Items[class].NoConsumeFromFloor then
- ButtonPanel.Consume = vgui.Create("DButton", ButtonPanel)
- ButtonPanel.Consume:Dock(TOP)
- ButtonPanel.Consume:SetTall(15)
- ButtonPanel.Consume:SetText("")
- ButtonPanel.Consume.Paint = function(self, w, h)
- local boxcolor = Color(0,0,0,255)
- local textcolor = Color(255,255,255,255)
- if self:IsHovered() then
- boxcolor = Color(255,255,255,255)
- textcolor = Color(0,0,0,255)
- end
- draw.RoundedBox( 0, 0, 0, w, h, boxcolor )
- draw.DrawText( "Eat", "Cyb_Inv_Label", w/2, 0, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- end
- ButtonPanel.Consume.DoClick = function(self)
- net.Start("base_ItemAction")
- net.WriteUInt(1, 4)
- net.WriteUInt(tr.Entity:EntIndex() , 32)
- net.WriteUInt(1, 4)
- net.SendToServer()
- end
- i = i + 15
- end
- if GAMEMODE.DayZ_Items[class].DrinkFunction and !GAMEMODE.DayZ_Items[class].NoConsumeFromFloor then
- ButtonPanel.Consume = vgui.Create("DButton", ButtonPanel)
- ButtonPanel.Consume:Dock(TOP)
- ButtonPanel.Consume:SetTall(15)
- ButtonPanel.Consume:SetText("")
- ButtonPanel.Consume.Paint = function(self, w, h)
- local boxcolor = Color(0,0,0,255)
- local textcolor = Color(255,255,255,255)
- if self:IsHovered() then
- boxcolor = Color(255,255,255,255)
- textcolor = Color(0,0,0,255)
- end
- draw.RoundedBox( 0, 0, 0, w, h, boxcolor )
- draw.DrawText( "Drink", "Cyb_Inv_Label", w/2, 0, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- end
- ButtonPanel.Consume.DoClick = function(self)
- net.Start("base_ItemAction")
- net.WriteUInt(1, 4)
- net.WriteUInt(tr.Entity:EntIndex() , 32)
- net.WriteUInt(2, 4)
- net.SendToServer()
- end
- i = i + 15
- end
- ButtonPanel.Collect = vgui.Create("DButton", ButtonPanel)
- ButtonPanel.Collect:Dock(TOP)
- ButtonPanel.Collect:SetTall(15)
- ButtonPanel.Collect:SetText("")
- ButtonPanel.Collect.Paint = function(self, w, h)
- local boxcolor = Color(0,0,0,255)
- local textcolor = Color(255,255,255,255)
- if self:IsHovered() then
- boxcolor = Color(255,255,255,255)
- textcolor = Color(0,0,0,255)
- end
- draw.RoundedBox( 0, 0, 0, w, h, boxcolor )
- draw.DrawText( "Collect", "Cyb_Inv_Label", w/2, 0, textcolor, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER )
- end
- ButtonPanel.Collect.DoClick = function(self)
- net.Start("base_ItemAction")
- net.WriteUInt(2, 4)
- net.WriteUInt(tr.Entity:EntIndex() , 32)
- net.SendToServer()
- end
- i = i + 15
- gui.EnableScreenClicker(true)
- ButtonPanel:SetPos((ScrW()/2)-75, (ScrH()/2)-(i/2) )
- ButtonPanel:SetSize(150, i)
- return
- end
- if IsValid(ButtonPanel) then ButtonPanel:Remove() gui.EnableScreenClicker(false) end
- local color = Color(200,200,200,255)
- surface.SetFont("Cyb_Inv_Label")
- local sizex, sizey = surface.GetTextSize(" - "..GAMEMODE.DayZ_Items[class].Desc)
- sizex = sizex+10
- if sizex < 130 then sizex = 130 end
- local x = ScrW()/2-(sizex/2)+5
- local y = ScrH()/2-55
- local perish = "Perishes in "..math.Round( tr.Entity:GetPerish() + 1 - CurTime() ).." seconds"
- draw.RoundedBox( 4, (ScrW()/2)-(sizex/2), (ScrH()/2)-60, sizex, 120, Color(0,0,0,220) )
- draw.DrawText( GAMEMODE.DayZ_Items[class].Name.." x"..tr.Entity:GetAmount(), "Cyb_Inv_Label", x, y, color, TEXT_ALIGN_LEFT )
- draw.DrawText( " - "..GAMEMODE.DayZ_Items[class].Desc, "Cyb_Inv_Label", x, y+15, color, TEXT_ALIGN_LEFT )
- draw.DrawText( "Condition: "..GetCondition(tr.Entity:GetCondition()), "Cyb_Inv_Label", x, y+50, color, TEXT_ALIGN_LEFT ) -- Conditions on the way...
- draw.DrawText( "Weight: "..GAMEMODE.DayZ_Items[class].Weight, "Cyb_Inv_Label", x, y+85, color, TEXT_ALIGN_LEFT )
- draw.DrawText( perish, "Cyb_Inv_Label", x, y+100, color, TEXT_ALIGN_LEFT )
- else
- if IsValid(ButtonPanel) then ButtonPanel:Remove() gui.EnableScreenClicker(false) end
- end
- if tr.Entity:IsPlayer() then
- if tr.Entity:GetMoveType() != MOVETYPE_NOCLIP and tr.Entity:Alive() then
- local TrgPos = tr.Entity:GetPos()+Vector(0,0,64)
- local ScrPos = (TrgPos + Vector( 0, 0, 10 )):ToScreen()
- local Distance = TrgPos:Distance( LocalPlayer():GetPos() )
- local Nick = tr.Entity:Nick()
- local GroupName = team.GetName(tr.Entity:Team()) or ""
- surface.SetFont("Cyb_HudTEXT")
- local Nickx, Nicky = surface.GetTextSize(Nick)
- Nickx = Nickx + 20
- if Nickx < 150 then Nickx = 200 end
- local BoxSize = 60
- local FreshPos = 25
- local FreshSpawn = false
- if GroupName != "" then
- BoxSize = BoxSize + 30
- FreshPos = FreshPos + 25
- end
- if tr.Entity:GetFreshSpawn() then
- FreshSpawn = true
- BoxSize = BoxSize + 30
- end
- local TheGroupColor = team.GetColor(tr.Entity:Team()) or Color(255, 255, 255, alp)
- if Distance < PHDayZ.NamedDistance then
- local alp = 255 * (math.abs((Distance-PHDayZ.NamedDistance))/600)
- TheGroupColor.a = alp
- draw.RoundedBox( 4, ScrPos.x-(Nickx/2), ScrPos.y-30, Nickx, BoxSize, Color( 0, 0, 0, alp ) )
- draw.DrawText(Nick, "Cyb_HudTEXT", ScrPos.x, ScrPos.y-20, Color(255, 255, 255, alp),TEXT_ALIGN_CENTER)
- if tr.Entity:Frags() >= PHDayZ.killstobebounty then
- draw.DrawText("[BOUNTY]", "Cyb_Inv_Bar", ScrPos.x, ScrPos.y+5, Color(255, 0, 0, alp),TEXT_ALIGN_CENTER)
- elseif tr.Entity:Frags() >= PHDayZ.killstobebandit then
- draw.DrawText("[BANDIT]", "Cyb_Inv_Bar", ScrPos.x, ScrPos.y+5, Color(200, 0, 0, alp),TEXT_ALIGN_CENTER)
- elseif tr.Entity:GetNWBool("friendly") == true and tr.Entity:Frags() < PHDayZ.killstobebandit then
- draw.DrawText("[HERO]", "Cyb_Inv_Bar", ScrPos.x, ScrPos.y+5, Color(0, 255, 0, alp),TEXT_ALIGN_CENTER)
- else
- draw.DrawText("[UNKNOWN]", "Cyb_Inv_Bar", ScrPos.x, ScrPos.y+5, Color(255, 255, 255, alp),TEXT_ALIGN_CENTER)
- end
- draw.DrawText(GroupName, "Cyb_HudTEXT", ScrPos.x, ScrPos.y+25, TheGroupColor,TEXT_ALIGN_CENTER)
- if FreshSpawn then
- draw.DrawText("[Fresh Spawn]", "Cyb_HudTEXT", ScrPos.x, ScrPos.y+FreshPos, Color(255,255,0),TEXT_ALIGN_CENTER)
- end
- end
- end
- end
- end
- local DMGIndicatorAlpha = 0
- local function ReceieveHurtInfo()
- local TimeH = 0.5
- LocalPlayer().DmgIndicatorTime = CurTime() + TimeH
- DMGIndicatorAlpha = 100
- end
- net.Receive("HurtInfo", function(len)
- ReceieveHurtInfo()
- end)
- hook.Add("HUDPaint", "DrawDamageIndicator", function()
- if DMGIndicatorAlpha <= 0 then return end
- if LocalPlayer().DmgIndicatorTime and LocalPlayer().DmgIndicatorTime < CurTime() then
- DMGIndicatorAlpha = DMGIndicatorAlpha - FrameTime() * 600
- end
- if DMGIndicatorAlpha > 0 then
- draw.RoundedBox( 0, 0, 0, ScrW(), ScrH(), Color( 255, 0, 0, DMGIndicatorAlpha ) )
- end
- end)
- local HitIndicatorAlpha = 0
- local function SendHitInfo()
- local Time = 0.5
- LocalPlayer().HitIndicatorTime = CurTime() + Time
- HitIndicatorAlpha = 255
- end
- net.Receive("SendHitInfo", function(len)
- SendHitInfo()
- end)
- hook.Add("HUDPaint", "DrawHitIndicator", function()
- if HitIndicatorAlpha <= 0 then return end
- if LocalPlayer().HitIndicatorTime and LocalPlayer().HitIndicatorTime < CurTime() then
- HitIndicatorAlpha = HitIndicatorAlpha - FrameTime() * 600
- end
- if HitIndicatorAlpha > 0 then
- local x = ScrW() / 2
- local y = ScrH() / 2
- local Lenght = 21 * (HitIndicatorAlpha / 255)
- Lenght = math.Clamp(Lenght, 8, Lenght)
- local Size = 7
- surface.SetDrawColor( 0, 0, 0, HitIndicatorAlpha )
- surface.DrawLine( x + Size, y - Size, x + Lenght, y - Lenght )
- surface.DrawLine( x - Size, y + Size, x -Lenght, y + Lenght )
- surface.DrawLine( x + Size, y + Size, x + Lenght, y + Lenght )
- surface.DrawLine( x - Size, y - Size, x - Lenght, y - Lenght )
- surface.SetDrawColor( 225, 225, 225, HitIndicatorAlpha )
- Lenght = 20 * (HitIndicatorAlpha / 255)
- Lenght = math.Clamp(Lenght, 8, Lenght)
- Size = 8
- surface.DrawLine( x + Size, y - Size, x + Lenght, y - Lenght )
- surface.DrawLine( x - Size, y + Size, x - Lenght, y + Lenght )
- surface.DrawLine( x + Size, y + Size, x + Lenght, y + Lenght )
- surface.DrawLine( x - Size, y - Size, x - Lenght, y - Lenght )
- end
- end)
- local healthmat = Material("cyb_mat/cyb_health.png", "smooth")
- local healthsmooth = 0
- local function DrawHealth()
- local w = 48
- local h = 48
- local padding = 133
- healthsmooth = math.Approach( healthsmooth, LocalPlayer():GetRealHealth(), 50 * FrameTime() )
- local percent = healthsmooth / 100
- local y = ScrH() - 175
- local color = Color( 140, 50, 50, 255 )
- if LocalPlayer():GetSick() or (LocalPlayer():GetRealHealth() < 25) then
- color = Color(Pulsate(1)*140, 50, 50, 255)
- end
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, Color(10, 10, 10, 150), false, true, false, true)
- render.SetMaterial( healthmat )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- Color( 10, 10, 40, 240 ),
- -90
- )
- render.SetScissorRect( 0, y+h/2 - (h * percent), padding + w, ScrH(), true )
- render.SetMaterial( healthmat )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- color,
- -90
- )
- render.SetScissorRect( 0, y+h/2, padding + w, ScrH(), false )
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( math.Round(percent*100), "Cyb_HudTEXTSmall", padding + w/2, y, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local function GetVehicleFuelValue()
- local vehicle = LocalPlayer():GetVehicle()
- if !IsValid(vehicle) then return false end
- if IsValid(vehicle:GetParent()) then vehicle = vehicle:GetParent() end
- if !vehicle.GetFuel then return false end
- return math.Round(vehicle:GetFuel())
- end
- local vehfuelmat = Material("gui/icon_cyb_64_fuel.png", "smooth")
- local function DrawVehicleFuel()
- if !GetVehicleFuelValue() then return end
- local w = 48
- local h = 48
- local padding = 15
- local percent = GetVehicleFuelValue() / 100
- local y = ScrH() - 285
- local color = Color( 255, 100, 0, 255 )
- if GetVehicleFuelValue() < 25 then
- color = Color(255, Pulsate(1)*100, 0, 255)
- end
- local boxcolor = Color(10, 10, 10, 150)
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( vehfuelmat )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- Color( 10, 10, 40, 240 ),
- -90
- )
- render.SetScissorRect( 0, y+h/2 - (h * percent), padding + w, ScrH(), true )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- color,
- -90
- )
- render.SetScissorRect( 0, y+h/2, padding + w, ScrH(), false )
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( GetVehicleFuelValue(), "Cyb_HudTEXTSmall", padding + w/2, y, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local function GetVehicleHealthValue()
- local vehicle = LocalPlayer():GetVehicle()
- if !IsValid(vehicle) then return false end
- if IsValid(vehicle:GetParent()) then vehicle = vehicle:GetParent() end
- return math.Round(vehicle:Health())
- end
- local function GetVehicleHealthValue()
- local vehicle = LocalPlayer():GetVehicle()
- if !IsValid(vehicle) then return false end
- if IsValid(vehicle:GetParent()) then vehicle = vehicle:GetParent() end
- local maxhealth = vehicle:GetMaxHealth()
- if maxhealth == 0 then maxhealth = 100 end
- return (vehicle:Health() / maxhealth)
- end
- local vehhealthmat = Material("gui/icon_cyb_64_spanner.png", "smooth")
- local function DrawVehicleHealth()
- if !GetVehicleHealthValue() then return end
- local w = 48
- local h = 48
- local padding = 75
- local percent = math.Round(GetVehicleHealthValue() * 100)
- local y = ScrH() - 285
- local color = Color( 0, 175, 63, 255 )
- if percent < 25 then
- color = Color(Pulsate(1)*255, 175, 63, 255)
- end
- local boxcolor = Color(10, 10, 10, 150)
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( vehhealthmat )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- Color( 10, 10, 40, 240 ),
- -90
- )
- render.SetScissorRect( 0, y+h/2 - (h * percent/100), padding + w, ScrH(), true )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- color,
- -90
- )
- render.SetScissorRect( 0, y+h/2, padding + w, ScrH(), false )
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( percent.."%", "Cyb_HudTEXTSmall", padding + w/2, y, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local thirstmat = Material("cyb_mat/cyb_thirst.png", "smooth")
- local thirstsmooth = 0
- local function DrawThirst()
- if !GetThirstValue() then return end
- local w = 48
- local h = 48
- local padding = 133
- thirstsmooth = math.Approach( thirstsmooth, GetThirstValue(), 50 * FrameTime() )
- local percent = thirstsmooth / 1000
- local y = ScrH() - 105
- local color = Color( 50, 50, 200, 255 )
- if GetThirstValue() < 25 then
- color = Color(50, 50, Pulsate(1)*200, 255)
- end
- local boxcolor = Color(10, 10, 10, 150)
- if ( LocalPlayer():GetSafeZone() or LocalPlayer():GetSafeZoneEdge() ) and PHDayZ.NoSafezoneDrain then
- boxcolor = Color(150, 150, 150, 50)
- end
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, false, true, false, true)
- render.SetMaterial( thirstmat )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- Color( 10, 10, 40, 240 ),
- -90
- )
- render.SetScissorRect( 0, y+h/2 - (h * percent), padding + w, ScrH(), true )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- color,
- -90
- )
- render.SetScissorRect( 0, y+h/2, padding + w, ScrH(), false )
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( math.Round(percent*1000), "Cyb_HudTEXTSmall", padding + w/2, y, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local hungermat = Material("cyb_mat/cyb_hunger.png", "smooth")
- local hungersmooth = 0
- local function DrawHunger()
- if !GetHungerValue() then return end
- local w = 48
- local h = 48
- local padding = 133
- hungersmooth = math.Approach( hungersmooth, GetHungerValue(), 50 * FrameTime() )
- local percent = hungersmooth / 1000
- local y = ScrH() - 35
- local color = Color( 50, 200, 50, 255 )
- if GetHungerValue() < 25 then
- color = Color(50, Pulsate(1)*200, 50, 255)
- end
- local boxcolor = Color(10, 10, 10, 150)
- if ( LocalPlayer():GetSafeZone() or LocalPlayer():GetSafeZoneEdge() ) and PHDayZ.NoSafezoneDrain then
- boxcolor = Color(150, 150, 150, 50)
- end
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, false, true, false, true)
- render.SetMaterial( hungermat )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- Color( 10, 10, 40, 240 ),
- -90
- )
- render.SetScissorRect( 0, y+h/2 - (h * percent), padding + w, ScrH(), true )
- render.SetMaterial( hungermat )
- render.DrawQuadEasy( Vector( padding + w/2, y),
- Vector(0,0,-1),
- w, h,
- color,
- -90
- )
- render.SetScissorRect( 0, y+h/2, padding + w, ScrH(), false )
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( math.Round(percent*1000), "Cyb_HudTEXTSmall", padding + w/2, y, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local hp_bg = Material( "cyb_mat/cyb_hpbg.png", "smooth" )
- local bloodsmooth = 0
- local function DrawBlood()
- if !LocalPlayer():Health() then return end
- local w = 94
- local h = 242
- local padding = 23
- bloodsmooth = math.Approach( bloodsmooth, LocalPlayer():Health(), 50 * FrameTime() )
- local percent = bloodsmooth / LocalPlayer():GetMaxHealth()
- local y = ScrH() - (10 * 3) - (20 * 3)
- local color = Color( 140, 50, 50, 255 )
- if LocalPlayer():GetBleed() or (LocalPlayer():Health() <= 20) then
- color = Color(Pulsate(1)*140, 50, 50, 255)
- end
- draw.RoundedBoxEx(4, padding-1, y-h/2, w, h, Color(10, 10, 10, 150), false, false, false, false)
- render.SetMaterial( hp_bg )
- render.DrawQuadEasy( Vector( padding + w/2, ScrH() - h/2,0),
- Vector(0,0,-1),
- w, h,
- Color( 40, 10, 10, 240 ),
- -90
- )
- render.SetScissorRect( 0, ScrH() - (h * percent), padding + w, ScrH(), true )
- render.SetMaterial( hp_bg )
- render.DrawQuadEasy( Vector( padding + w/2, ScrH() - h/2,0),
- Vector(0,0,-1),
- w, h,
- color,
- -90
- )
- render.SetScissorRect( 0, ScrH() - h + 20, padding + w, ScrH(), false )
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( ""..math.Round(percent*100)/20 .. " L", "Cyb_HudTEXTSmall", padding + w/2 - 4, ScrH() - h/2 - 26, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local function DrawXP()
- local padding = 0
- local w = 12
- local h = 211
- local bgc = Color( 10, 10, 10, 150 )
- local inc = Color( 30, 30, 30, 200 )
- local plyxp = LocalPlayer():GetXP() or 0
- LocalPlayer().CL_Level = LocalPlayer():GetLevel() or 1
- XPBarLength = plyxp/(PHDayZ.XPLevelMultiplier * LocalPlayer().CL_Level)
- local offset = 10
- local percent = plyxp/(PHDayZ.XPLevelMultiplier * LocalPlayer().CL_Level)
- local y = math.Round( h * percent )
- draw.RoundedBoxEx(4, offset + padding, ScrH() - padding - h, w, h, Color(10, 10, 10, 150), true, false, true, false)
- draw.RoundedBoxEx(4, offset + padding, ScrH() - padding - y, w, h, Color(50, 120, 50, 255), true, true, true, true)
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( LocalPlayer().CL_Level, "Cyb_HudTEXTSmall", offset + padding + w/2, ScrH() - 10, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local staminasmooth = 0
- local function DrawStamina()
- local padding = 13
- local w = 12
- local h = 211
- local bgc = Color( 10, 10, 10, 150 )
- local inc = Color( 30, 30, 30, 200 )
- local plystamina = LocalPlayer():GetStamina() or 100
- staminasmooth = math.Approach( staminasmooth, plystamina*10, 50 * FrameTime() )
- local offset = 103
- local percent = staminasmooth / 1000
- local y = h * percent
- draw.RoundedBoxEx(4, offset + padding, ScrH() - h, w, h, Color(10, 10, 10, 150), false, true, false, true)
- draw.RoundedBoxEx(4, offset + padding, ScrH() - y, w, h, Color(120, 120, 50, 255), true, true, false, true)
- if GUI_ShowHUDLabels > 0 then
- draw.SimpleTextOutlined( plystamina, "Cyb_HudTEXTSmall", offset + padding + w/2, ScrH() - 10, Color( 255, 255, 255, 255 ), 1, 1, 0.5, Color( 0, 0, 0, 255 ))
- end
- end
- local radsmooth = 0
- local function DrawStatusEffects()
- local w = 48
- local h = 48
- local padding = 203
- local y = ScrH() - 35
- local color = Color( 255, 100, 0, 255 )
- local boxcolor = Color(10, 10, 10, 150)
- if LocalPlayer():GetSick() or healthsmooth < 50 then
- drawBlurAt( 0, 0, ScrW(), ScrH(), (50-healthsmooth)/4, nil, true )
- draw.RoundedBox( 0, 0, 0, ScrW(), ScrH(), Color(20, 0, 0, math.Clamp( 255-(healthsmooth*5), 0, 150 ) ) )
- end
- if bloodsmooth < 50 then
- drawBlurAt( 0, 0, ScrW(), ScrH(), (50-bloodsmooth)/4, nil, true )
- draw.RoundedBox( 0, 0, 0, ScrW(), ScrH(), Color(50, 50, 50, math.Clamp( 255-(bloodsmooth*5), 0, 150 ) ) )
- end
- radsmooth = math.Approach( radsmooth, LocalPlayer():GetRadiation(), 50 * FrameTime() )
- if radsmooth > 50 then
- util.ScreenShake( Vector( 0, 0, 0 ), 0.3, 5, 1, 0 )
- draw.RoundedBox( 0, 0, 0, ScrW(), ScrH(), Color(0, 40, 0, math.Clamp( radsmooth*2, 0, 150 ) ) )
- end
- if LocalPlayer():GetFreshSpawn() then
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( hp_bg )
- render.DrawQuadEasy( Vector( padding + w/2, y,0),
- Vector(0,0,-1),
- w-22, h,
- Color( Pulsate(0.5)*40, Pulsate(0.5)*40, Pulsate(0.5)*10, 240 ),
- -90
- )
- AnyStatus = true
- padding = padding + 70
- end
- if LocalPlayer():GetTagTime() > CurTime() then
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( hp_bg )
- render.DrawQuadEasy( Vector( padding + w/2, y,0),
- Vector(0,0,-1),
- w-22, h,
- Color( Pulsate(0.5)*40, Pulsate(0.5)*10, Pulsate(0.5)*10, 240 ),
- -90
- )
- AnyStatus = true
- padding = padding + 70
- end
- if GetHungerValue() < 250 then
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( hungermat )
- render.DrawQuadEasy( Vector( padding + w/2, y,0),
- Vector(0,0,-1),
- w, h,
- Color( Pulsate(0.5)*10, Pulsate(0.5)*80, Pulsate(0.5)*10, 240 ),
- -90
- )
- AnyStatus = true
- padding = padding + 70
- end
- if GetThirstValue() < 250 then
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( thirstmat )
- render.DrawQuadEasy( Vector( padding + w/2, y,0),
- Vector(0,0,-1),
- w, h,
- Color( Pulsate(0.5)*10, Pulsate(0.5)*10, Pulsate(0.5)*80, 240 ),
- -90
- )
- AnyStatus = true
- padding = padding + 70
- end
- if LocalPlayer():GetBleed() then
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( thirstmat )
- render.DrawQuadEasy( Vector( padding + w/2, y,0),
- Vector(0,0,-1),
- w, h,
- Color( Pulsate(0.5)*40, Pulsate(0.5)*10, Pulsate(0.5)*10, 240 ),
- -90
- )
- AnyStatus = true
- padding = padding + 70
- end
- if LocalPlayer():GetSick() then
- draw.RoundedBoxEx(4, padding-5, y-h/2-5, w+10, h+10, boxcolor, true, true, true, true)
- render.SetMaterial( healthmat )
- render.DrawQuadEasy( Vector( padding + w/2, y,0),
- Vector(0,0,-1),
- w, h,
- Color( Pulsate(0.5)*10, Pulsate(0.5)*40, Pulsate(0.5)*10, 240 ),
- -90
- )
- AnyStatus = true
- padding = padding + 70
- end
- end
- function GM:HUDPaint( )
- if (GUI_ShowHUD == 0) or DZ_MENUBLUR or !AliveChar then ShowSetupErrors() DZ_LoadingScreen() return end
- local SW,SH = ScrW(),ScrH()
- DZ_LoadingScreen()
- if LocalPlayer():Alive() then
- DrawStatusEffects()
- DrawBlood()
- DrawHealth()
- DrawThirst()
- DrawHunger()
- DrawStamina()
- DrawXP()
- --DrawProcessBar()
- WSWITCH:Draw(LocalPlayer())
- DrawVehicleFuel()
- DrawVehicleHealth()
- ShowSetupErrors()
- ShowSZPopup()
- ShowMissingContent()
- GAMEMODE:HUDDrawTargetID()
- else
- if !DeathMessage then return end
- local deathcountdown = math.Round(CurDeathTime - CurTime())
- if deathcountdown <= 0 then
- deathcountdown = 0
- end
- local DeadBoxW = ScrW()
- local DeadBoxH = 150
- draw.RoundedBox(0,SW/2-(DeadBoxW/2),SH/2-(DeadBoxH/2),DeadBoxW,DeadBoxH,Color( 0,0, 0, 200 ))
- draw.DrawText("YOU DIED", "char_title", SW/2, SH/2-50, Color(255, 0, 0, 255),TEXT_ALIGN_CENTER)
- draw.DrawText(DeathMessage, "char_options1", SW/2, SH/2, Color(150, 150, 150, 255),TEXT_ALIGN_CENTER)
- if DeathMessage2 != "" then
- draw.DrawText(DeathMessage2, "char_options1", SW/2, SH/2+30, Color(150, 150, 150, 255),TEXT_ALIGN_CENTER)
- return
- end
- draw.DrawText(deathcountdown.." seconds til respawn!", "char_options1", SW/2, SH/2+30, Color(150, 150, 150, 255),TEXT_ALIGN_CENTER)
- end
- local intAmmoInMag = 0
- local intAmmoOutMag = 0
- if LocalPlayer():GetActiveWeapon():IsValid() and LocalPlayer():GetActiveWeapon():IsWeapon() then
- intAmmoInMag = LocalPlayer():GetActiveWeapon():Clip1()
- intAmmoOutMag = LocalPlayer():GetAmmoCount(LocalPlayer():GetActiveWeapon():GetPrimaryAmmoType())
- end
- if !WSWITCH.Show and LocalPlayer():GetActiveWeapon():IsValid() && LocalPlayer():GetActiveWeapon():Clip1() >= 0 && LocalPlayer():GetActiveWeapon():GetClass() != "weapon_physcannon" then
- --draw.RoundedBox(10,SW - 201,SH -81,151,72,Color( 50, 50, 50, 255 ))
- draw.RoundedBox(6,SW - 200,SH -70,250,100,Color( 0, 0, 0, 200 )) -- Small Ammo Box
- surface.SetDrawColor(255,255,255,255)
- surface.SetTextColor(Color(255,255,255))
- surface.SetFont("AmmoType1")
- local x,y = surface.GetTextSize( intAmmoInMag )
- surface.SetTextPos(SW-140-x/2,SH-35-y/2)
- surface.DrawText( intAmmoInMag )
- surface.SetTextColor(Color(150,0,0))
- surface.SetFont("AmmoType2")
- local x,y = surface.GetTextSize( intAmmoOutMag )
- surface.SetTextPos(SW-90-x/2,SH-25-y/2)
- surface.DrawText( "x "..intAmmoOutMag )
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement