Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function Base()
- local width1 = ScrW()
- local height1 = ScrH()
- local DrawHealth = LocalPlayer():Health() or 0
- local EchoHealth = LocalPlayer():Health() or 0
- local drawHealth2 = (width1 / 5) / 100 * DrawHealth
- local DrawArmour = LocalPlayer():Armor() or 0
- local EchoArmour = LocalPlayer():Armor() or 0
- local drawArmour2 = (width1 / 5) / 100 * DrawArmour or 0
- local NickName = LocalPlayer():Nick()
- draw.RoundedBox(6,18 ,703,380 ,180 ,Color(55,43,182,255))
- draw.RoundedBox(6,20 ,705,375 ,175 ,Color(135,206,235,245)) --Main box
- draw.RoundedBox(6,45,height1 - 100 ,324,12,Color(0,0,0,255)) --Health outer box
- draw.RoundedBox(6,45,height1 - 70 ,324,12,Color(0,0,0,255)) --Armourouterbox 751
- draw.RoundedBox(6,width1 - 1557,height1 - 187,68,68,Color(55,43,182,255))
- if DrawHealth > 100 then DrawHealth = 100 end
- if DrawHealth < 0 then DrawHealth = 0 end
- if DrawArmour >= 1 then
- draw.RoundedBox(6,47,height1 - 69,drawArmour2,10,Color(0,0,255,255)) --Armour
- end
- if DrawHealth >= 1 then
- draw.RoundedBox(6,47,height1 - 99 ,drawHealth2,10,Color(255,0,0,255)) --Health
- end
- draw.DrawText( "Armour:"..EchoArmour, "EquisFont", width1 - 1545, 812,Color(255,255,255))
- draw.DrawText( "Health:"..EchoHealth, "EquisFont", width1 - 1545, 780,Color(255,255,255))
- draw.DrawText(NickName,"EquisFont2",width1 - 1450,height1 - 170,Color(255,255,255))
- draw.DrawText("Money $"..LocalPlayer():getDarkRPVar( "money" ),"EquisFont2",width1 - 1420,height1 - 50,Color(255,255,255))
- draw.DrawText("Salary:"..LocalPlayer():getDarkRPVar( "salary" ),"EquisFont2",width1 - 1545,height1 - 50,Color(255,255,255))
- draw.DrawText("Job:"..LocalPlayer():getDarkRPVar( "job" ),"EquisFont2",width1 - 1375,height1 - 170,Color(255,255,255))
- draw.DrawText("Steam ID:"..LocalPlayer():SteamID(),"EquisFont2",width1 - 1450,height1 - 150,Color(255,255,255))
- local Avatar = vgui.Create( "AvatarImage", Panel )
- Avatar:SetSize( 64, 64 )
- Avatar:SetPos( width1 - 1555, height1 - 185 )
- Avatar:SetPlayer( LocalPlayer(), 64 )
- end
- --[[---------------------------------------------------------------------------
- HUD ConVars
- ---------------------------------------------------------------------------]]
- local ConVars = {}
- local HUDWidth
- local HUDHeight
- local Color = Color
- local CurTime = CurTime
- local cvars = cvars
- local DarkRP = DarkRP
- local draw = draw
- local GetConVar = GetConVar
- local hook = hook
- local IsValid = IsValid
- local Lerp = Lerp
- local localplayer
- local math = math
- local pairs = pairs
- local ScrW, ScrH = ScrW, ScrH
- local SortedPairs = SortedPairs
- local string = string
- local surface = surface
- local table = table
- local timer = timer
- local tostring = tostring
- local plyMeta = FindMetaTable("Player")
- local DrawPicture = false
- local ply = LocalPlayer()
- local drawpic = false
- surface.CreateFont( "EquisFont", {
- font = "Tiki Tropic", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 20,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- surface.CreateFont( "EquisFont2", {
- font = "CrashLanding BB", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
- extended = false,
- size = 20,
- weight = 500,
- blursize = 0,
- scanlines = 0,
- antialias = true,
- underline = false,
- italic = false,
- strikeout = false,
- symbol = false,
- rotary = false,
- shadow = false,
- additive = false,
- outline = false,
- } )
- local function ReloadConVars()
- ConVars = {
- background = {0,0,0,100},
- Healthbackground = {0,0,0,200},
- Healthforeground = {140,0,0,180},
- HealthText = {255,255,255,200},
- Job1 = {0,0,150,200},
- Job2 = {0,0,0,255},
- salary1 = {0,150,0,200},
- salary2 = {0,0,0,255}
- }
- for name, Colour in pairs(ConVars) do
- ConVars[name] = {}
- for num, rgb in SortedPairs(Colour) do
- local CVar = GetConVar(name .. num) or CreateClientConVar(name .. num, rgb, true, false)
- table.insert(ConVars[name], CVar:GetInt())
- if not cvars.GetConVarCallbacks(name .. num, false) then
- cvars.AddChangeCallback(name .. num, function()
- timer.Simple(0, ReloadConVars)
- end)
- end
- end
- ConVars[name] = Color(unpack(ConVars[name]))
- end
- HUDWidth = (GetConVar("HudW") or CreateClientConVar("HudW", 240, true, false)):GetInt()
- HUDHeight = (GetConVar("HudH") or CreateClientConVar("HudH", 115, true, false)):GetInt()
- if not cvars.GetConVarCallbacks("HudW", false) and not cvars.GetConVarCallbacks("HudH", false) then
- cvars.AddChangeCallback("HudW", function() timer.Simple(0,ReloadConVars) end)
- cvars.AddChangeCallback("HudH", function() timer.Simple(0,ReloadConVars) end)
- end
- end
- ReloadConVars()
- local Scrw, Scrh, RelativeX, RelativeY
- --[[---------------------------------------------------------------------------
- HUD separate Elements
- ---------------------------------------------------------------------------]]
- local function GunLicense()
- if LocalPlayer():getDarkRPVar("HasGunlicense") then
- draw.RoundedBox(6,500,500,50,50,Color(255,255,125))
- end
- end
- local agendaText
- local function Agenda()
- local agenda = LocalPlayer():getAgendaTable()
- if not agenda then return end
- agendaText = agendaText or DarkRP.textWrap((localplayer:getDarkRPVar("agenda") or ""):gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
- draw.RoundedBox(10, 10, 10, 460, 110, colors.gray1)
- draw.RoundedBox(10, 12, 12, 456, 106, colors.gray2)
- draw.RoundedBox(10, 12, 12, 456, 20, colors.darkred)
- draw.DrawNonParsedText(agenda.Title, "DarkRPHUD1", 30, 12, colors.red, 0)
- draw.DrawNonParsedText(agendaText, "DarkRPHUD1", 30, 35, colors.white, 0)
- end
- hook.Add("DarkRPVarChanged", "agendaHUD", function(ply, var, _, new)
- if ply ~= localplayer then return end
- if var == "agenda" and new then
- agendaText = DarkRP.textWrap(new:gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
- else
- agendaText = nil
- end
- if var == "salary" then
- salaryText = DarkRP.getPhrase("salary", DarkRP.formatMoney(new), "")
- end
- if var == "job" or var == "money" then
- JobWalletText = string.format("%s\n%s",
- DarkRP.getPhrase("job", var == "job" and new or localplayer:getDarkRPVar("job") or ""),
- DarkRP.getPhrase("wallet", var == "money" and DarkRP.formatMoney(new) or DarkRP.formatMoney(localplayer:getDarkRPVar("money")), "")
- )
- end
- end)
- local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl")
- local function DrawVoiceChat()
- if LocalPlayer().DRPIsTalking then
- local _, chboxY = chat.GetChatBoxPos()
- local Rotating = math.sin(CurTime() * 3)
- local backwards = 0
- if Rotating < 0 then
- Rotating = 1 - (1 + Rotating)
- backwards = 180
- end
- surface.SetTexture(VoiceChatTexture)
- surface.SetDrawColor(ConVars.Healthforeground)
- surface.DrawTexturedRectRotated(Scrw - 100, chboxY, Rotating * 96, 96, backwards)
- end
- end
- local function LockDown()
- local chbxX, chboxY = chat.GetChatBoxPos()
- if GetGlobalBool("DarkRP_LockDown") then
- local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_LockdownHUD")
- if shouldDraw == false then return end
- local cin = (math.sin(CurTime()) + 1) / 2
- local chatBoxSize = math.floor(Scrh / 4)
- draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
- end
- end
- local Arrested = function() end
- usermessage.Hook("GotArrested", function(msg)
- local StartArrested = CurTime()
- local ArrestedUntil = msg:ReadFloat()
- Arrested = function()
- local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_ArrestedHUD")
- if shouldDraw == false then return end
- if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
- draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil((ArrestedUntil - (CurTime() - StartArrested)) * 1 / game.GetTimeScale())), "DarkRPHUD1", Scrw / 2, Scrh - Scrh / 12, colors.white, 1)
- elseif not localplayer:getDarkRPVar("Arrested") then
- Arrested = function() end
- end
- end
- end)
- local AdminTell = function() end
- usermessage.Hook("AdminTell", function(msg)
- timer.Remove("DarkRP_AdminTell")
- local Message = msg:ReadString()
- AdminTell = function()
- draw.RoundedBox(4, 10, 10, Scrw - 20, 110, colors.darkblack)
- draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", Scrw / 2 + 10, 10, colors.white, 1)
- draw.DrawNonParsedText(Message, "ChatFont", Scrw / 2 + 10, 90, colors.brightred, 1)
- end
- timer.Create("DarkRP_AdminTell", 10, 1, function()
- AdminTell = function() end
- end)
- end)
- --[[---------------------------------------------------------------------------
- Entity HUDPaint things
- ---------------------------------------------------------------------------]]
- -- Draw a player's name, health and/or job above the head
- -- This syntax allows for easy overriding
- plyMeta.drawPlayerInfo = plyMeta.drawPlayerInfo or function(self)
- local pos = self:EyePos()
- pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
- pos = pos:ToScreen()
- if not self:getDarkRPVar("wanted") then
- -- Move the text up a few pixels to compensate for the height of the text
- pos.y = pos.y - 50
- end
- if GAMEMODE.Config.showname then
- local nick, plyTeam = self:Nick(), self:Team()
- draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
- draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
- end
- if GAMEMODE.Config.showhealth then
- local health = DarkRP.getPhrase("health", self:Health())
- draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
- draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
- end
- if GAMEMODE.Config.showjob then
- local teamname = self:getDarkRPVar("job") or team.GetName(self:Team())
- draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
- draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
- end
- if self:getDarkRPVar("HasGunlicense") then
- surface.SetMaterial(Page)
- surface.SetDrawColor(255,255,255,255)
- surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
- end
- end
- -- Draw wanted information above a player's head
- -- This syntax allows for easy overriding
- plyMeta.drawWantedInfo = plyMeta.drawWantedInfo or function(self)
- if not self:Alive() then return end
- local pos = self:EyePos()
- if not pos:isInSight({localplayer, self}) then return end
- pos.z = pos.z + 10
- pos = pos:ToScreen()
- if GAMEMODE.Config.showname then
- local nick, plyTeam = self:Nick(), self:Team()
- draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
- draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
- end
- local wantedText = DarkRP.getPhrase("wanted", tostring(self:getDarkRPVar("wantedReason")))
- draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, colors.white1, 1)
- draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, colors.red, 1)
- end
- --[[---------------------------------------------------------------------------
- The Entity display: draw HUD information about entities
- ---------------------------------------------------------------------------]]
- local function DrawEntityDisplay()
- local shootPos = LocalPlayer():GetShootPos()
- local aimVec = LocalPlayer():GetAimVector()
- for k, ply in pairs(players or player.GetAll()) do
- if ply == localplayer or not ply:Alive() or ply:GetNoDraw() then continue end
- local hisPos = ply:GetShootPos()
- if ply:getDarkRPVar("wanted") then ply:drawWantedInfo() end
- if GAMEMODE.Config.globalshow then
- ply:drawPlayerInfo()
- -- Draw when you're (almost) looking at him
- elseif hisPos:DistToSqr(shootPos) < 160000 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 break end
- ply:drawPlayerInfo()
- end
- end
- end
- local tr = LocalPlayer():GetEyeTrace()
- if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():DistToSqr(localplayer:GetPos()) < 40000 then
- tr.Entity:drawOwnableInfo()
- end
- end
- --[[---------------------------------------------------------------------------
- Drawing death notices
- ---------------------------------------------------------------------------]]
- function GAMEMODE:DrawDeathNotice(x, y)
- if not GAMEMODE.Config.showdeaths then return end
- self.Sandbox.DrawDeathNotice(self, x, y)
- end
- --[[---------------------------------------------------------------------------
- Display notifications
- ---------------------------------------------------------------------------]]
- local function DisplayNotify(msg)
- local txt = msg:ReadString()
- GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
- surface.PlaySound("buttons/lightswitch2.wav")
- -- Log to client console
- MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n")
- end
- usermessage.Hook("_Notify", DisplayNotify)
- --[[---------------------------------------------------------------------------
- Remove some elements from the HUD in favour of the DarkRP HUD
- ---------------------------------------------------------------------------]]
- function GAMEMODE:HUDShouldDraw(name)
- if name == "CHudHealth" or
- name == "CHudBattery" or
- name == "CHudSuitPower" or
- (HelpToggled and name == "CHudChat") then
- return false
- else
- return self.Sandbox.HUDShouldDraw(self, name)
- end
- end
- --[[---------------------------------------------------------------------------
- Disable players' names popping up when looking at them
- ---------------------------------------------------------------------------]]
- function GAMEMODE:HUDDrawTargetID()
- return false
- end
- --[[---------------------------------------------------------------------------
- Actual HUDPaint hook
- ---------------------------------------------------------------------------]]
- function DrawHUD()
- local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD")
- if shouldDraw == false then return end
- --cust2om
- Base()
- --default
- GunLicense()
- Agenda()
- DrawVoiceChat()
- LockDown()
- Arrested()
- AdminTell()
- DrawEntityDisplay()
- end
- hook.Add("HUDPaint", "DrawHUD", DrawHUD)
- --You steal this hud you're a dick from Ambient
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement