--NOTE TO SELF -- Refactor a lot of this, tidy up code. This fucking script is an absolute mess. /*----------------------------------------------------------------------------------- Rainbow Dash's DarkRP HUD Version 1.5 Date last modified: 10/12/2013 Special thanks to: FPtje (aka Falco) for the original DarkRP HUD, from which this is derived from. Lixquid for your work with the ammo section. Much appreciated. The guys at MLSRP for accepting my first attempt at LUA coding for testing. Whoever made that tutorial for making huds. This is derived from that too. Shendow for creating the VGUI for changing the HUD. Should stop people from getting pissy now. Known Bugs: Some color customizations don't apply. This is from the recent redesign. Dependencies: Rank display REQUIRES FAdmin at this time. To-Do List: - Clean up code. Please report any bugs to admin@friendshipisgaming.net ------------------------------------------------------------------------------------- Use common sense with this. Don't resell this, and dont buy once for 20 odd people. If there is a problem you can fix, or you need someone to fix it, go right ahead. Please also note: There is a bit of code here taken straight from the default HUD. This is simply compatibility, as these features are NOT capable of being called from this script, unless they are in this script. The list of items taken straight from the default HUD are: - ConVars loop - Agenda (slightly modified) - Voice Chat Icon Most of these will be rewritten at a later date. */ /*-------------------------- Over-rides. ---------------------------- These bits disable incomplete or potentially buggy code. The code CAN work, but its disabled because it will not work without prerequisits. Each one is explained anyway. Set each variable to true to disable the sad safety mechanisms i coded in. We also need these to run first. I left ammo on by default because I like it. However, set it off and the default one will draw. */ CreateClientConVar( "customhud_disabled", "0", true, false ) CreateClientConVar( "customhud_shadow", "1", true, false ) local dorank = true -- Do we draw the ULX based ranks? DONT CHANGE THIS local forcetotop = true -- Force the name and job to be drawn on the top? POINTL local doammo = true -- Do we want to draw ammo? /*-------------------------- Hook ---------------------------- This hook is important. Its what tells DarkRP to not draw its disgusting hud. Then we add our version of the file. */ /*-------------------------- Variables n shit ---------------------------- This section defines a lot of the variables. With it, we can speed up shit a lot. A lot of this is just copy-paste from the original file, but I am doing this because I don't see a better way */ local ConVars = {} local Defaults = {} 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("weaponhud", 1, true, false) surface.CreateFont("TrebRlyBig", {font = "Trebuchet24", size = 28, weight = 1000}) surface.CreateFont("TrebMed", {font = "Trebuchet24", size = 24, weight = 600}) surface.CreateFont("TrebMed2", {font = "Trebuchet24", size = 16, weight = 600}) surface.CreateFont("TrebSmall", {font = "Trebuchet24", size = 16, weight = 650}) surface.CreateFont( "RUND_TEXT", {font = "Arial",size = 15,weight = 500} ) /*-------------------------------------------------------- Hud Colors ---------------------------------------------------------- This is where you can define the colors for the hud. Each color is named appropriately. I KINDA stole this idea from Falco, but it makes it much easier to modify. This also provides support for making a hud color modification menu. I dont provide this, However, be my guest to make such a menu for this. */ local function ReloadConVars() ConVars = { background1 = {0,142,230,200}, -- Background of all the windows outline = {0,27,179,200}, -- Outline of all the windows walletlabel = {255,255,255,255}, -- Label for your wallet walletlabeloutline = {0,0,0,255}, -- Outline for your wallet label wallet2 = {0,65,0,255}, -- Actual wallet color wallet2outline = {0,0,0,255}, -- Actual wallet color outline salarylabel = {255,255,255,255}, -- Label for your salary salarylabeloutline = {0,0,0,255}, -- Outline for your salary label salary = {0,65,0,255}, -- Actual salary color salaryoutline = {0,0,0,255}, -- Actual salary color outline salaryunemployed = {255,0,0,255}, --Color of salary if the person is unemployed IE no salary. healthlabel = {240,0,4,255}, -- Label for health healthlabeloutline = {0,0,0,255}, -- Outline for health label armorlabel = {217,224,0,255}, -- Label for Armor armorlabeloutline = {0,0,0,255}, -- Outline for Armor Label ammolabel = {217,224,0,255}, -- Label for ammo ranklabel = {0,27,179,255}, -- Label for rank ranklabeloutline = {0,0,0,255}, -- Outline for rank label name = {255,255,255,255}, -- the color of your name nameoutline = {0,0,0,255}, -- the color of your name job = {255,255,255,255}, -- the color of your job joboutline = {0,0,0,255}, -- the color of your job healthbar = {255,0,0,255}, -- the color of the health bar healthbarbg = {0,27,179,200}, -- the background of the health bar and its outline healthbaroutline = {0,0,0,255}, -- the background of the health bar and its outline healthbartext = {255,255,255,255}, -- the color of the health bar text healthbardeadtext = {255,0,0,255}, -- the color of the health bar text when you are dead. armorbar = {0,0,255,255}, -- the color of the armor bar armorbarbg = {0,142,230,200}, -- the background of the armor bar. I set this to be the same as Background only darker normally armorbaroutline = {0,27,179,200}, -- the outline of the armor bar armorbartext = {255,255,255,255}, -- the text of the armor bar armorbartextoutline = {255,255,255,255}, -- the text of the armor bar armorbarnonetext = {255,0,0,255}, -- the text when you have no armor ammobar = {167,174,0,255}, -- the ammo bar. ammobarbg = {0,27,179,200}, -- its background ammobartext = {200,220,255,255}, -- its text. Currently we don't define it when empty. ammobartextoutline = {255,255,255,255}, -- the text of the armor bar ammobartextshad = {0,0,0,255}, -- its shaddow. Make this black (255,255,255,255) if you have a light color as ammobartext nameandjobdivider = {25,25,25,200}, -- the color of that divider between your name and job. agendabg = {0,27,179,155}, --Background and outline of agenda agendabody = {0,142,230,100}, -- the main body of agenda agendatextoutline = {0,0,0,255}, -- the main body of agenda agendatitletext = {255,255,255,255}, -- the title text agendatitletextoutline = {0,0,0,255}, -- the title text agendatitle = {0, 0, 0, 200}, -- the title bar color agendatext = {255,255,255,255}, -- the actual text jobwanted = {255,0,0,255}, -- Color of text when wanted (job) namewanted = {255,0,0,255}, -- Color of text when wanted (name) wanted = {255,0,0,255}, -- Color of text when wanted wantedoutline = {0,0,0,255}, -- Color of text when wanted (outline) ranktext = {255,255,255,255}, -- rank text ranktextshad = {0,0,0,255}, -- shaddow voicecolor = {255,0,0,255}, -- Voice wantedbox = {255,255,255,255}, -- Wanted box healthbardeadtextoutline = {0,0,0,255}, -- Health Bar Dead Text Outline healthbartextoutline = {0,0,0,255}, -- Health Bad Text Outline armorbarnonetextoutline = {0,0,0,255}, -- armor bar none text outline armorbartextoutline = {0,0,0,255}, -- armor bar text outline ammobaroutline = {0,0,0,255}, -- ammo bar outline ammolabeloutline = {0,0,0,255}, -- ammo label outline ammobartextlow = {255,255,0,255}, -- ammo bar text low ammobartextout = {255,0,0,255}, } CreateClientConVar( "drawhudontop", 1, true, false ) -- These next few lines are a page straight out of Falco's code. I use it because 1, its proven to work, and 2, my hud is based off of his format. -- Also im no good with in pairs for name, Colour in pairs(ConVars) do -- Shendow: Setup the defaults.. Defaults[name] = Colour 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 -- Shendow: List of "clean names" for ConVars local ConVarNames = { ["agendabg"] = "Agenda - Outline/Background", ["agendabody"] = "Agenda - Background", ["agendatext"] = "Agenda - Text", ["agendatextoutline"] = "Agenda - Text Outline", ["agendatitle"] = "Agenda - Title", ["agendatitletext"] = "Agenda - Title Text", ["agendatitletextoutline"] = "Agenda - Title Text - Outline", ["ammobar"] = "Ammo Bar", ["ammobarbg"] = "Ammo Bar - Background", ["ammobaroutline"] = "Ammo Bar - Outline", ["ammobartext"] = "Ammo Bar - Text", ["ammobartextlow"] = "Ammo Bar - Text (Low)", ["ammobartextout"] = "Ammo Bar - Text (Out)", ["ammobartextoutline"] = "Ammo Bar Text Outline", ["ammobartextshad"] = "Ammo Bar - Text Outline", ["ammolabel"] = "Ammo Label", ["ammolabeloutline"] = "Ammo Label Outline", ["armorbar"] = "Armor Bar", ["armorbarbg"] = "Armor Bar - Background", ["armorbaroutline"] = "Armor Bar - Outline", ["armorbarnonetext"] = "Armor Bar - Text when empty", ["armorbarnonetextoutline"] = "Armor Bar - Text when empty - Outline", ["armorbartext"] = "Armor Bar - Text", ["armorbartextoutline"] = "Armor Bar - Text - Outline", ["armorlabel"] = "Armor Label", ["armorlabeloutline"] = "Armor Label Outline", ["background1"] = "Background", ["healthbar"] = "Health Bar", ["healthbarbg"] = "Health Bar - Background", ["healthbaroutline"] = "Health Bar - Outline", ["healthbardeadtext"] = "Health Bar - Text when dead", ["healthbartext"] = "Health Bar - Text", ["healthbardeadtextoutline"] = "Health Bar Text - Dead - Outline", ["healthbartextoutline"] = "Health Bar Text - Outline", ["healthlabel"] = "Health Label", ["healthlabeloutline"] = "Health Label Outline", ["job"] = "Job", ["jobwanted"] = "Job Wanted", ["joboutline"] = "Job Outline", ["name"] = "Name", ["nameandjobdivider"] = "Divider between Name and Job", ["namewanted"] = "Name Wanted", ["nameoutline"] = "Name Outline", ["outline"] = "Main Outline", ["ranklabel"] = "Rank - Label", ["ranklabeloutline"] = "Rank - Label Outline", ["ranktext"] = "Rank - Text", ["ranktextshad"] = "Rank - Text Shadow", ["salary"] = "Salary", ["salaryoutline"] = "Salary Outline", ["salarylabel"] = "Salary Label", ["salarylabeloutline"] = "Salary Label Outline", ["salaryunemployed"] = "Salary when unemployed", ["voicecolor"] = "Voice Color", ["wallet2"] = "Wallet", ["wallet2outline"] = "Wallet Outline", ["walletlabel"] = "Wallet Label", ["walletlabeloutline"] = "Wallet Label Outline", ["wanted"] = "Wanted Indicator", ["wantedoutline"] = "Wanted Outline", ["wantedbox"] = "Wanted Box", } -- Shendow: Create the menu here! function CreateHUDEditMenu() if (IsValid(pHUDEdit)) then pHUDEdit:Remove() pHUDEdit = nil end local w, h = 500, 300 local frame = vgui.Create("DFrame") frame:SetTitle("HUD - Edit Colors") frame:SetSize(w, h) frame:Center() frame:MakePopup() pHUDEdit = frame // Choose which HUD element you wanna modify local wi, he = 200, 20 local choice = vgui.Create("DComboBox", frame) choice:SetSize(wi, he) choice:SetPos(5, 30) // Incase you want to reset.. local wi, he = 125, 20 local reset = vgui.Create("DButton", frame) reset:SetText("Reset to defaults") reset:SetSize(wi, he) reset:SetPos(w - 5 - wi, 30) reset.DoClick = function() for name, color in pairs (Defaults) do RunConsoleCommand(name .. "1", color[1]) RunConsoleCommand(name .. "2", color[2]) RunConsoleCommand(name .. "3", color[3]) RunConsoleCommand(name .. "4", color[4]) end end // Easy as that! local color = vgui.Create("DColorMixer", frame) color:StretchToParent(5, 35 + he, 5, 5) color.UpdateConVar = function(me, name, key, color) if (!me.name) then return end local r, g, b, a = color.r, color.g, color.b, color.a RunConsoleCommand(me.name .. "1", r) RunConsoleCommand(me.name .. "2", g) RunConsoleCommand(me.name .. "3", b) RunConsoleCommand(me.name .. "4", a) end // We need to declare this after everything because otherwise the mixer doesn't exist choice.OnSelect = function(me, index, value, data) local clr = ConVars[data] color.name = nil color:SetColor(Color(clr.r, clr.g, clr.b, clr.a)) color.name = data end // We need to sort alphabetically first.. local tbl = {} for name, color in pairs (Defaults) do table.insert(tbl, name) end table.sort(tbl) for _, name in pairs (tbl) do local color = Defaults[name] choice:AddChoice(ConVarNames[name] or name, name) end end concommand.Add("hud_colormenu", CreateHUDEditMenu) -- Shendow: Chat commands?! local cmd = "!hud" hook.Add("OnPlayerChat", "HandleHUDEditCommand", function(ply, text, team) if (text == cmd) then if (IsValid(ply) and ply == LocalPlayer()) then CreateHUDEditMenu() end return true end end) /*hook.Add("OnPlayerChat", "ToggleText", function(ply, txt, team) if (text == "!toggleoutline") then if (IsValid(ply) and ply == LocalPlayer()) then if GetConVarNumber("customhud_shadow") != 1 then end end end end end*/ local ply = LocalPlayer() -- Useless, but I keep it anyway. local arrestedPlayers = {} function ProperNoun(String) -- Function for capitalizing the first letter. Idea from SPM. local newstring = nil for k, v in pairs(string.Split(String, "_")) do if not newstring then newstring = string.upper(string.sub(v,0,1))..string.lower(string.sub(v,2)) else newstring = newstring.." "..string.upper(string.sub(v,0,1))..string.lower(string.sub(v,2)) end end return newstring end local clamp, cos, sin, deg2rad = math.Clamp, math.cos, math.sin, math.pi/180 function DrawPartialCircle( x, y, radius, linewidth, startangle, endangle, aa ) aa = aa or 1; startangle = clamp( startangle or 0, 0, 360 ); endangle = clamp( endangle or 360, 0, 360 ); if endangle < startangle then local temp = endangle; endangle = startangle; startangle = temp; end for i=startangle, endangle, aa do local _i = i * deg2rad; surface.DrawTexturedRectRotated(cos( _i ) * (radius - linewidth) + x,sin( _i ) * (radius - linewidth) + y, linewidth, aa*2, -i ); end end function SimpleTextWithOutline(text, font, w, h, col, halign, valign, col2) -- This code cleans up outlines. This function reduces what would have been 70 lines to 16 lines due to reuse of code. draw.SimpleText(text, font, w + 1, h + 1, col, halign, valign) draw.SimpleText(text, font, w + 1, h - 1, col, halign, valign) draw.SimpleText(text, font, w - 1, h + 1, col, halign, valign) draw.SimpleText(text, font, w - 1, h - 1, col, halign, valign) if col2 then draw.SimpleText(text, font, w, h, col2, halign, valign) end end function DrawTextWithOutline(text, font, w, h, col, halign, col2) -- This code cleans up outlines. This function reduces what would have been 70 lines to 16 lines due to reuse of code. draw.DrawText(text, font, w + 1, h + 1, col, halign) draw.DrawText(text, font, w + 1, h - 1, col, halign) draw.DrawText(text, font, w - 1, h + 1, col, halign) draw.DrawText(text, font, w - 1, h - 1, col, halign) if col2 then draw.DrawText(text, font, w, h, col2, halign) end end function ply:isArrested() return arrestedPlayers[self:SteamID()] end function GetClipSize(ply) -- Define the size of the clip. For the ammo hud. local wep = ply:GetActiveWeapon() local gettab = wep:GetTable() if not wep then return elseif not gettab then return elseif type(gettab) != "table" then return else return wep:GetTable().Primary.DefaultClip end end function GetClipSizeV2(ply) -- Yes im repeating the old function and changing ONE thing BUT I HAVE MY REASONS local wep = ply:GetActiveWeapon() local gettab = wep:GetTable() if not wep then return elseif not gettab then return elseif type(gettab) != "table" or type(wep) != "table" then return else return wep:GetTable().Primary.DefaultClip end end function GetClipSize1(ply) local wep = ply:GetActiveWeapon() local gettab = wep:GetTable() if not wep then return elseif not gettab then return elseif type(gettab) != "table" or type(wep) != "table" then return else return wep:GetTable().Primary.ClipSize end end function GetAmmoForCurrentWeapon( ply ) local wep = ply:GetActiveWeapon() if not wep then return elseif wep then return ply:GetAmmoCount( wep:GetPrimaryAmmoType() ) else return end end function GetClipForCurrentWeapon( ply ) local wep = ply:GetActiveWeapon() if not wep then return elseif wep then if ply:Alive() == true and IsValid(wep) then return wep:Clip1() end else return end end function SwepName( ply ) local wep = ply:GetActiveWeapon() if not wep then return elseif wep then if ply:Alive() == true and IsValid(wep) then return wep:GetClass() end else return end end ReloadConVars() local function formatNumber(n) if not n then return "" end if type(n) == "string" then return n end if type(n) != "string" and 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 local Page = Material("icon16/gun.png") local LongestLine local TallestLine local function Agenda() local agendabg = Color(GetConVarNumber("agendabg1"),GetConVarNumber("agendabg2"),GetConVarNumber("agendabg3"),GetConVarNumber("agendabg4")) or ConVars.agendabg local agendabody = Color(GetConVarNumber("agendabody1"),GetConVarNumber("agendabody2"),GetConVarNumber("agendabody3"),GetConVarNumber("agendabody4")) or ConVars.agendabody local agendatitle = Color(GetConVarNumber("agendatitle1"),GetConVarNumber("agendatitle2"),GetConVarNumber("agendatitle3"),GetConVarNumber("agendatitle4")) or ConVars.agendatitle local agendatitletext = Color(GetConVarNumber("agendatitletext1"),GetConVarNumber("agendatitletext2"),GetConVarNumber("agendatitletext3"),GetConVarNumber("agendatitletext4")) or ConVars.agendatitletext local agendatitletextoutline = Color(GetConVarNumber("agendatitletextoutline1"),GetConVarNumber("agendatitletextoutline2"),GetConVarNumber("agendatitletextoutline3"),GetConVarNumber("agendatitletextoutline4")) or ConVars.agendatitletextoutline local agendatext = Color(GetConVarNumber("agendatext1"),GetConVarNumber("agendatext2"),GetConVarNumber("agendatext3"),GetConVarNumber("agendatext4")) or ConVars.agendatext local agendatextoutline = Color(GetConVarNumber("agendatextoutline1"),GetConVarNumber("agendatextoutline2"),GetConVarNumber("agendatextoutline3"),GetConVarNumber("agendatextoutline4")) or ConVars.agendatextoutline 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 if SwepName(LocalPlayer()) != "gmod_tool" then surface.SetFont("DarkRPHUD1") local titlew, titleh = surface.GetTextSize(DrawAgenda.Title) LongestLine = LongestLine or 440 TallestLine = TallestLine or 0 draw.RoundedBox(10, 10, 10, LongestLine + 40, TallestLine + 34,agendabg) draw.RoundedBox(10, 12, 12, LongestLine + 36, TallestLine + 30,agendabody) draw.RoundedBox(10, 12, 12, LongestLine + 36, 20, agendatitle) draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 30+1, 12+1, agendatitletextoutline,0) draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 30+1, 12-1, agendatitletextoutline,0) draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 30-1, 12+1, agendatitletextoutline,0) draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 30-1, 12-1, agendatitletextoutline,0) draw.DrawText(DrawAgenda.Title, "DarkRPHUD1", 30, 12, agendatitletext,0) 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 = DarkRP.textWrap(text, "DarkRPHUD1", 440) if text == "" then text = "No agenda has been set yet" end local textw, texty = surface.GetTextSize(text) LongestLine = math.max(titlew, textw) TallestLine = math.max(texty, 0) draw.DrawText(text, "DarkRPHUD1", 30+1, 35+1, agendatextoutline,0) draw.DrawText(text, "DarkRPHUD1", 30+1, 35-1, agendatextoutline,0) draw.DrawText(text, "DarkRPHUD1", 30-1, 35+1, agendatextoutline,0) draw.DrawText(text, "DarkRPHUD1", 30-1, 35-1, agendatextoutline,0) draw.DrawText(text, "DarkRPHUD1", 30, 35, agendatext,0) end end end local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl") -- Lets get rid of this. local function DrawVoiceChat() local voicecolor = Color(GetConVarNumber("voicecolor1"),GetConVarNumber("voicecolor2"),GetConVarNumber("voicecolor3"),GetConVarNumber("voicecolor4")) or ConVars.voicecolor if localplayer.DRPIsTalking then local chbxX, 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(voicecolor) surface.DrawTexturedRectRotated(ScrW() - 100, chboxY, Rotating*96, 96, backwards) end end local Warning = Material("icon16/exclamation.png") local JailBird = Material("icon16/time.png") local Arrested = function() end usermessage.Hook("GotArrested", function(msg) local StartArrested = CurTime() local ArrestedUntil = msg:ReadFloat() Arrested = function() local background1 = Color(GetConVarNumber("background11"),GetConVarNumber("background12"),GetConVarNumber("background13"),GetConVarNumber("background14")) or ConVars.background1 local outline = Color(GetConVarNumber("outline1"),GetConVarNumber("outline2"),GetConVarNumber("outline3"),GetConVarNumber("outline4")) or ConVars.outline if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then --draw.DrawText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "DarkRPHUD1", ScrW()/2, ScrH() - ScrH()/12, Color(155,155,255,255), 1) draw.RoundedBox(12, ScrW() / 2 - 68, 57, 68 + 68, 50, outline) -- Name and job outline draw.RoundedBox(10, ScrW() / 2 - 64, 60, 64 + 64, 43, background1) -- Name and job box draw.DrawText(math.ceil(ArrestedUntil - (CurTime() - StartArrested)), "DarkRPHUD2", ScrW() / 2 + 25, 72, Color(0, 0, 0, 200), TEXT_ALIGN_CENTER) draw.DrawText(math.ceil(ArrestedUntil - (CurTime() - StartArrested)), "DarkRPHUD2", ScrW() / 2 + 1 + 25, 72 - 1, namewanted, TEXT_ALIGN_CENTER) surface.SetMaterial(JailBird) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect(ScrW() / 2 - 54, 66, 32, 32) 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() local title = DarkRP.getPhrase("listen_up") or LANGUAGE.listen_up AdminTell = function() local cin = (math.sin(CurTime()) + 1) / 2 draw.RoundedBox(8, 10, 120, ScrW() - 20, 115, Color(cin * 255, 0, 255 - (cin * 255),100)) draw.DrawText(title, "GModToolName", ScrW() / 2 + 10 + 1, 120 + 1, Color(0, 0, 0, 255), 1) draw.DrawText(title, "GModToolName", ScrW() / 2 + 10 + 1, 120 - 1, Color(0, 0, 0, 255), 1) draw.DrawText(title, "GModToolName", ScrW() / 2 + 10 - 1, 120 + 1, Color(0, 0, 0, 255), 1) draw.DrawText(title, "GModToolName", ScrW() / 2 + 10 - 1, 120 - 1, Color(0, 0, 0, 255), 1) draw.DrawText(title, "GModToolName", ScrW() / 2 + 10, 120, Color(30, 200, 30, 255), 1) draw.DrawText(Message, "ChatFont", ScrW() / 2 + 10+1, 205+1, Color(0, 0, 0, 255), 1) draw.DrawText(Message, "ChatFont", ScrW() / 2 + 10-1, 205+1, Color(0, 0, 0, 255), 1) draw.DrawText(Message, "ChatFont", ScrW() / 2 + 10+1, 205-1, Color(0, 0, 0, 255), 1) draw.DrawText(Message, "ChatFont", ScrW() / 2 + 10-1, 205-1, Color(0, 0, 0, 255), 1) draw.DrawText(Message, "ChatFont", ScrW() / 2 + 10, 205, Color(255, 255, 255, 255), 1) end timer.Simple(10, function() AdminTell = function() end end) end) function DoActualHUD() -- Ignore this line, it makes things faster. LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {} --These next few bits eliminate the errors on first connect. --Do this on anything that isn't a plain text label or something, like the name. --If the money is not set, don't do anything local v1 = formatNumber(LocalPlayer().DarkRPVars.money) -- This gives the money of the player. if not v1 then v1 = "" end -- Make sure its set. If not, lets prevent errors. --If the salary is not set, don't do anything local v2 = formatNumber(LocalPlayer().DarkRPVars.salary) if not v2 then v2 = "" end --If the health isn't set, don't do anything if not hp then hp = 0 end -- without this, Lerp plays up. hp = math.min(100, (hp == LocalPlayer():Health() and hp) or Lerp(0.1, hp, LocalPlayer():Health())) -- Lerp the value, that way we get a smooth hp effect. if not hp then hp = 0 end -- Double check to see if it set. Not rly needed i dont think -- If the armor is not set, don't do anything if not armor then armor = 0 end -- without this, Lerp plays up armor = math.min(100, (armor == LocalPlayer():Armor() and armor) or Lerp(0.1, armor, LocalPlayer():Armor())) if not armor then armor = 0 end -- Something I use to hide the lockdown indicator. I'm an idiot, cause i called it "wanted". if not hidewanted then hidewanted = 0 end hidewanted = Lerp(0.1, hidewanted, GetConVarNumber("DarkRP_LockDown") * 70) if not hidewanted then hidewanted = 0 end -- Gun license shit if not hidegun then hidegun = 0 end -- Dunno why i did this. if not gunlic then gunlic = 0 end local gunlic = gunlic or 0 if LocalPlayer():getDarkRPVar("HasGunlicense") then gunlic = 1 else gunlic = 0 end if not gunlic then gunlic = 0 end hidegun = Lerp(0.1, hidegun, gunlic * 70) if not hidegun then hidegun = 0 end -- If the job is not set, display "Connecting" local job = LocalPlayer().DarkRPVars.job if not job then job = "Connecting" end -- The job, -- If the players name is not set, DONT DO JACK SHIT! local name = LocalPlayer():Nick() -- Player's name. if not name then name = "" end local wantedText = DarkRP.getPhrase("wanted", tostring(LocalPlayer():getDarkRPVar("wantedReason"))) or LANGUAGE.wantedReason or "" local infobox = name .. " - " .. job .. "\n $" .. v1 .. " + $" .. v2 .. "\n" .. ProperNoun(LocalPlayer():GetNWString("usergroup")) -- All up, all the info for the player. Name, Job, New line, Wallet, Salary, New line, players rank, going through my own function to format it. if not infobox then infobox = "Still loading..." end if not bh1 then bh1 = 84 end if not bh2 then bh2 = 82 end if not bh3 then bh3 = 56 end //TEST AREA local qfix = 0 local healthstatus = healthstatus or "Healthy" if LocalPlayer():Health() > 90 then healthstatus = "Healthy" elseif LocalPlayer():Health() > 70 then healthstatus = "Hurt" elseif LocalPlayer():Health() > 45 then healthstatus = "Wounded" elseif LocalPlayer():Health() > 20 then healthstatus = "Badly Wounded" elseif LocalPlayer():Health() > 0 then healthstatus = "Near Death" else healthstatus = "Dead" end local cx = 42+27 local cy = ScrH()-130 local poly_tbl = {{ },{ },{ }} poly_tbl[1]["x"] = cx -10 poly_tbl[1]["y"] = cy poly_tbl[1]["u"] = 0 poly_tbl[1]["v"] = 0 poly_tbl[2]["x"] = cx + 10 poly_tbl[2]["y"] = cy poly_tbl[2]["u"] = 1 poly_tbl[2]["v"] = 0 poly_tbl[3]["x"] = cx poly_tbl[3]["y"] = cy + 10 poly_tbl[3]["u"] = 0 poly_tbl[3]["v"] = 1 surface.SetDrawColor( Color( 0, 0, 0, 150 ) ) surface.DrawPoly( poly_tbl ) //surface.SetTexture(154) //surface.DrawCircle(ScrW() / 2, ScrH() / 2, 100, Color(255,0,0,255)) // // Here comes trouble. -- Hey, if you look closely with standard LUA syntax highlighting in Notepad ++, it looks like some sort of wave is forming below. local background1 = Color(GetConVarNumber("background11"),GetConVarNumber("background12"),GetConVarNumber("background13"),GetConVarNumber("background14")) or ConVars.background1 local outline = Color(GetConVarNumber("outline1"),GetConVarNumber("outline2"),GetConVarNumber("outline3"),GetConVarNumber("outline4")) or ConVars.outline local walletlabel = Color(GetConVarNumber("walletlabel1"),GetConVarNumber("walletlabel2"),GetConVarNumber("walletlabel3"),GetConVarNumber("walletlabel4")) or ConVars.walletlabel local wallet2 = Color(GetConVarNumber("wallet21"),GetConVarNumber("wallet22"),GetConVarNumber("wallet23"),GetConVarNumber("wallet24")) or ConVars.wallet2 local wallet2outline = Color(GetConVarNumber("wallet2outline1"),GetConVarNumber("wallet2outline2"),GetConVarNumber("wallet2outline3"),GetConVarNumber("wallet2outline4")) or ConVars.wallet2outline local salarylabel = Color(GetConVarNumber("salarylabel1"),GetConVarNumber("salarylabel2"),GetConVarNumber("salarylabel3"),GetConVarNumber("salarylabel4")) or ConVars.salarylabel local salary = Color(GetConVarNumber("salary1"),GetConVarNumber("salary2"),GetConVarNumber("salary3"),GetConVarNumber("salary4")) or ConVars.salary local salaryoutline = Color(GetConVarNumber("salaryoutline1"),GetConVarNumber("salaryoutline2"),GetConVarNumber("salaryoutline3"),GetConVarNumber("salaryoutline4")) or ConVars.salaryoutline local salaryunemployed = Color(GetConVarNumber("salaryunemployed1"),GetConVarNumber("salaryunemployed2"),GetConVarNumber("salaryunemployed3"),GetConVarNumber("salaryunemployed4")) or ConVars.salaryunemployed local healthlabel = Color(GetConVarNumber("healthlabel1"),GetConVarNumber("healthlabel2"),GetConVarNumber("healthlabel3"),GetConVarNumber("healthlabel4")) or ConVars.healthlabel local armorlabel = Color(GetConVarNumber("armorlabel1"),GetConVarNumber("armorlabel2"),GetConVarNumber("armorlabel3"),GetConVarNumber("armorlabel4")) or ConVars.armorlabel local ranklabel = Color(GetConVarNumber("ranklabel1"),GetConVarNumber("ranklabel2"),GetConVarNumber("ranklabel3"),GetConVarNumber("ranklabel4")) or ConVars.ranklabel local namecolor = Color(GetConVarNumber("name1"),GetConVarNumber("name2"),GetConVarNumber("name3"),GetConVarNumber("name4")) or ConVars.name local jobcolor = Color(GetConVarNumber("job1"),GetConVarNumber("job2"),GetConVarNumber("job3"),GetConVarNumber("job4")) or ConVars.job local healthbar = Color(GetConVarNumber("healthbar1"),GetConVarNumber("healthbar2"),GetConVarNumber("healthbar3"),GetConVarNumber("healthbar4")) or ConVars.healthbar local healthbarbg = Color(GetConVarNumber("healthbarbg1"),GetConVarNumber("healthbarbg2"),GetConVarNumber("healthbarbg3"),GetConVarNumber("healthbarbg4")) or ConVars.healthbarbg local healthbartext = Color(GetConVarNumber("healthbartext1"),GetConVarNumber("healthbartext2"),GetConVarNumber("healthbartext3"),GetConVarNumber("healthbartext4")) or ConVars.healthbartext local healthbartextoutline = Color(GetConVarNumber("healthbartextoutline1"),GetConVarNumber("healthbartextoutline2"),GetConVarNumber("healthbartextoutline3"),GetConVarNumber("healthbartextoutline4")) or ConVars.healthbartextoutline local healthbardeadtext = Color(GetConVarNumber("healthbardeadtext1"),GetConVarNumber("healthbardeadtext2"),GetConVarNumber("healthbardeadtext3"),GetConVarNumber("healthbardeadtext4")) or ConVars.healthbardeadtext local healthbardeadtextoutline = Color(GetConVarNumber("healthbardeadtextoutline1"),GetConVarNumber("healthbardeadtextoutline2"),GetConVarNumber("healthbardeadtextoutline3"),GetConVarNumber("healthbardeadtextoutline4")) or ConVars.healthbardeadtextoutline local armorbar = Color(GetConVarNumber("armorbar1"),GetConVarNumber("armorbar2"),GetConVarNumber("armorbar3"),GetConVarNumber("armorbar4")) or ConVars.armorbar local armorbarbg = Color(GetConVarNumber("armorbarbg1"),GetConVarNumber("armorbarbg2"),GetConVarNumber("armorbarbg3"),GetConVarNumber("armorbarbg4")) or ConVars.armorbarbg local armorbartext = Color(GetConVarNumber("armorbartext1"),GetConVarNumber("armorbartext2"),GetConVarNumber("armorbartext3"),GetConVarNumber("armorbartext4")) or ConVars.armorbartext local armorbartextoutline = Color(GetConVarNumber("armorbartextoutline1"),GetConVarNumber("armorbartextoutline2"),GetConVarNumber("armorbartextoutline3"),GetConVarNumber("armorbartextoutline4")) or ConVars.armorbartextoutline local armorbarnonetext = Color(GetConVarNumber("armorbarnonetext1"),GetConVarNumber("armorbarnonetext2"),GetConVarNumber("armorbarnonetext3"),GetConVarNumber("armorbarnonetext4")) or ConVars.armorbarnonetext local armorbarnonetextoutline = Color(GetConVarNumber("armorbarnonetextoutline1"),GetConVarNumber("armorbarnonetextoutline2"),GetConVarNumber("armorbarnonetextoutline3"),GetConVarNumber("armorbarnonetextoutline4")) or ConVars.armorbarnonetextoutline local nameandjobdivider = Color(GetConVarNumber("nameandjobdivider1"),GetConVarNumber("nameandjobdivider2"),GetConVarNumber("nameandjobdivider3"),GetConVarNumber("nameandjobdivider4")) or ConVars.nameandjobdivider local jobwanted = Color(GetConVarNumber("jobwanted1"),GetConVarNumber("jobwanted2"),GetConVarNumber("jobwanted3"),GetConVarNumber("jobwanted4")) or ConVars.jobwanted local namewanted = Color(GetConVarNumber("namewanted1"),GetConVarNumber("namewanted2"),GetConVarNumber("namewanted3"),GetConVarNumber("namewanted4")) or ConVars.namewanted local ranktext = Color(GetConVarNumber("ranktext1"),GetConVarNumber("ranktext2"),GetConVarNumber("ranktext3"),GetConVarNumber("ranktext4")) or ConVars.ranktext local ranktextshad = Color(GetConVarNumber("ranktextshad1"),GetConVarNumber("ranktextshad2"),GetConVarNumber("ranktextshad3"),GetConVarNumber("ranktextshad4")) or ConVars.ranktextshad local armorbaroutline = Color(GetConVarNumber("armorbaroutline1"),GetConVarNumber("armorbaroutline2"),GetConVarNumber("armorbaroutline3"),GetConVarNumber("armorbaroutline4")) or ConVars.armorbaroutline local armorlabeloutline = Color(GetConVarNumber("armorlabeloutline1"),GetConVarNumber("armorlabeloutline2"),GetConVarNumber("armorlabeloutline3"),GetConVarNumber("armorlabeloutline4")) or ConVars.armorlabeloutline local healthlabeloutline = Color(GetConVarNumber("healthlabeloutline1"),GetConVarNumber("healthlabeloutline2"),GetConVarNumber("healthlabeloutline3"),GetConVarNumber("healthlabeloutline4")) or ConVars.healthlabeloutline local walletlabeloutline = Color(GetConVarNumber("walletlabeloutline1"),GetConVarNumber("walletlabeloutline2"),GetConVarNumber("walletlabeloutline3"),GetConVarNumber("walletlabeloutline4")) or ConVars.walletlabeloutline local salarylabeloutline = Color(GetConVarNumber("salarylabeloutline1"),GetConVarNumber("salarylabeloutline2"),GetConVarNumber("salarylabeloutline3"),GetConVarNumber("salarylabeloutline4")) or ConVars.salarylabeloutline local healthbaroutline = Color(GetConVarNumber("healthbaroutline1"),GetConVarNumber("healthbaroutline2"),GetConVarNumber("healthbaroutline3"),GetConVarNumber("healthbaroutline4")) or ConVars.healthbaroutline local armorbaroutline = Color(GetConVarNumber("armorbaroutline1"),GetConVarNumber("armorbaroutline2"),GetConVarNumber("armorbaroutline3"),GetConVarNumber("armorbaroutline4")) or ConVars.armorbaroutline local ranklabeloutline = Color(GetConVarNumber("ranklabeloutline1"),GetConVarNumber("ranklabeloutline2"),GetConVarNumber("ranklabeloutline3"),GetConVarNumber("ranklabeloutline4")) or ConVars.ranklabeloutline local nameoutline = Color(GetConVarNumber("nameoutline1"),GetConVarNumber("nameoutline2"),GetConVarNumber("nameoutline3"),GetConVarNumber("nameoutline4")) or ConVars.nameoutline local joboutline = Color(GetConVarNumber("joboutline1"),GetConVarNumber("joboutline2"),GetConVarNumber("joboutline3"),GetConVarNumber("joboutline4")) or ConVars.joboutline local wanted = Color(GetConVarNumber("wanted1"),GetConVarNumber("wanted2"),GetConVarNumber("wanted3"),GetConVarNumber("wanted4")) or ConVars.wanted local wantedoutline = Color(GetConVarNumber("wantedoutline1"),GetConVarNumber("wantedoutline2"),GetConVarNumber("wantedoutline3"),GetConVarNumber("wantedoutline4")) or ConVars.wantedoutline local wantedbox = Color(GetConVarNumber("wantedbox1"),GetConVarNumber("wantedbox2"),GetConVarNumber("wantedbox3"),GetConVarNumber("wantedbox4")) or ConVars.wantedbox if LocalPlayer():SteamID() == "STEAM_0:1:68209808" or LocalPlayer():SteamID() == "STEAM_0:1:34891769" or LocalPlayer():SteamID() == "STEAM_0:1:18382851" or LocalPlayer():SteamID() == "STEAM_0:0:26625625" then local freq = .6 local red = (math.sin(freq*CurTime() + 0) * 127 + 128) local green = (math.sin(freq*CurTime() + 2) * 127 + 128) local blue = (math.sin(freq*CurTime() + 4) * 127 + 128) namecolor = Color(red,green,blue,255) --namewanted = Color(red,green,blue,255) end local SWEP = LocalPlayer():GetActiveWeapon() local swepname = "" if SWEP:IsValid() then clip1type = SWEP:GetPrimaryAmmoType() or "" clip1 = tonumber(SWEP:Clip1()) or 0 clip1b = tonumber(SWEP:Clip1()) or 0 clip1left = LocalPlayer():GetAmmoCount(clip1type) swepname = string.upper(SWEP:GetPrintName()) --bh1 = math.min(124, (bh1 == 124 and bh1) or Lerp(0.1, bh1, 124)) --bh2 = math.min(122, (bh2 == 122 and bh2) or Lerp(0.1, bh2, 122)) else clip1 = 0 clip1b = 0 clip1left = 0 swepname = "NOTHING" --bh1 = math.min(124, (bh1 == 104 and bh1) or Lerp(0.1, bh1, 104)) --bh2 = math.min(122, (bh2 == 102 and bh2) or Lerp(0.1, bh2, 102)) end if !IsValid(SWEP) or SWEP:GetPrimaryAmmoType() == -1 then bh1 = math.min(124, (bh1 == 84 and bh1) or Lerp(0.1, bh1, 84)) bh2 = math.min(122, (bh2 == 82 and bh2) or Lerp(0.1, bh2, 82)) bh3 = math.min(96, (bh3 == 56 and bh3) or Lerp(0.1, bh3, 56)) else bh1 = math.min(124, (bh1 == 124 and bh1) or Lerp(0.1, bh1, 124)) bh2 = math.min(122, (bh2 == 122 and bh2) or Lerp(0.1, bh2, 122)) bh3 = math.min(96, (bh3 == 96 and bh3) or Lerp(0.1, bh3, 96)) end if clip1 == -1 then clip1b = 0 end draw.RoundedBox(12, 115, ScrH() - bh1, 120, 50, outline) draw.RoundedBox(10, 118, ScrH() - bh2, 114, 45, background1) if clip1 == -1 then SimpleTextWithOutline(clip1left,"TrebMed",222,ScrH() - bh3,wallet2outline, TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP,wallet2) else SimpleTextWithOutline(clip1b .. " / " .. clip1left,"TrebMed",222,ScrH() - bh3,wallet2outline, TEXT_ALIGN_RIGHT,TEXT_ALIGN_TOP,wallet2) end surface.SetFont("TrebMed2") local wepw, weph = surface.GetTextSize(swepname) Sweplong = math.max(wepw or 120,120) draw.RoundedBox(12, 115, ScrH() - 45, wepw+18, 40, outline) draw.RoundedBox(10, 118, ScrH() - 43, wepw+12, 35, background1) SimpleTextWithOutline(swepname,"TrebMed2",125,ScrH() - 12,wallet2outline, TEXT_ALIGN_LEFT,TEXT_ALIGN_TOP,wallet2) surface.SetFont("TrebSmall") local hudw, hudh = surface.GetTextSize(infobox) LongestLine1 = math.max(hudw or 100,100) --draw.SimpleText(LongestLine1,"TrebMed",ScrW() / 2, ScrH() / 2, Color(255,255,255,255)) TallestLine1 = TallestLine1 or 0 local cin = (math.sin(CurTime()) + 1) / 2 draw.RoundedBox(12,45+hidewanted+LongestLine1, ScrH()-92, 52, 30, Color(cin * 255, 0, 255 - (cin * 255), GetConVarNumber("outline4"))) -- Name and job outline draw.RoundedBox(10, 45+hidewanted+LongestLine1+3,ScrH() - 89, 46, 24, wantedbox) -- Name and job box surface.SetMaterial(Warning) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect(45+hidewanted+LongestLine1+29, ScrH() - 85, 16, 16) draw.RoundedBox(12, 45+hidegun+LongestLine1, ScrH()-62, 52, 30, outline) -- Name and job outline draw.RoundedBox(10, 45+hidegun+LongestLine1+3, ScrH()-59, 46, 24, background1) -- Name and job box surface.SetMaterial(Page) surface.SetDrawColor(255, 255, 255, 255) surface.DrawTexturedRect(45+hidegun+LongestLine1+29, ScrH() - 55, 16, 16) draw.RoundedBox(12, 43, ScrH() - 92, LongestLine1+95, 60, outline) -- Player info outline draw.RoundedBox(10, 45, ScrH() - 90, LongestLine1+89, 55, background1) -- Player info box for i = 1, 8 do surface.SetDrawColor(Color(150,150,150,255)) DrawPartialCircle( 70, ScrH()-70, 80,80, 0, 360,i) surface.SetDrawColor(Color(0,0,0,15)) DrawPartialCircle( 70, ScrH()-70, 54, 11, 0, 360,i) surface.SetDrawColor(Color(0,0,0,255)) DrawPartialCircle( 70, ScrH()-70, 49, 1, 0, 360,i) DrawPartialCircle( 70, ScrH()-70, 41, 1, 0, 360,i) if armor >= 1 then surface.SetDrawColor(Color(0,0,255,150)) DrawPartialCircle( 70, ScrH()-70, 50,8, 0, Lerp(armor/100,0,360), i ) end if hp >= 1 then surface.SetDrawColor(Color(Lerp(hp/100,255,0),Lerp(hp/100,0,255),0,150)) DrawPartialCircle( 70, ScrH()-70, 45, 5, 0, Lerp(hp/100,0,360), i ) end end surface.SetFont("TrebSmall") local hpw, hph = surface.GetTextSize(healthstatus) draw.RoundedBox( 0, 68-((hpw+12)/2), ScrH()-150, hpw+12, 20, Color( 0, 0, 0, 150 ) ) SimpleTextWithOutline( healthstatus, "TrebSmall", 68, ScrH()-140,Color(0,0,0,150),TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER, Color(Lerp(hp/100,255,0),Lerp(hp/100,0,255),0,150)) -- string.ToMinutesSecondsMilliseconds(math.Round(endtime, 2)) DrawTextWithOutline(infobox,"TrebSmall",123, ScrH() - 88, wallet2outline, TEXT_ALIGN_LEFT, wallet2) --SimpleTextWithOutline(job,"TrebSmall",125, ScrH() - 65, wallet2outline, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, wallet2) --SimpleTextWithOutline("$" .. v1 .. " + $" .. v2,"TrebSmall",123, ScrH() - 53, wallet2outline, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, wallet2) --SimpleTextWithOutline(ProperNoun(LocalPlayer():GetNWString("usergroup")),"TrebSmall",118, ScrH() - 41, wallet2outline, TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, wallet2) -- Backgrounds if LocalPlayer():getDarkRPVar("wanted") then local cin = (math.sin(CurTime()) + 1) / 2 surface.SetFont("DarkRPHUD2") local wantedw, wantedh = surface.GetTextSize(wantedText) local wantedw1 = wantedw / 2 draw.RoundedBox(12, ScrW() / 2 - (wantedw1 + 9), 57, (wantedw + 17), 53, Color(cin * 255, 0, 255 - (cin * 255), GetConVarNumber("outline4"))) -- Name and job outline draw.RoundedBox(10, ScrW() / 2 - (wantedw1 + 5), 60, (wantedw + 9), 46, wantedbox) -- Name and job box draw.DrawText(wantedText, "DarkRPHUD2", ScrW() / 2 + 1, 62 + 1, wantedoutline, TEXT_ALIGN_CENTER) -- DrawText isnt SimpleText. So we make up for that. draw.DrawText(wantedText, "DarkRPHUD2", ScrW() / 2 + 1, 62 - 1, wantedoutline, TEXT_ALIGN_CENTER) draw.DrawText(wantedText, "DarkRPHUD2", ScrW() / 2 - 1, 62 + 1, wantedoutline, TEXT_ALIGN_CENTER) draw.DrawText(wantedText, "DarkRPHUD2", ScrW() / 2 - 1, 62 - 1, wantedoutline, TEXT_ALIGN_CENTER) draw.DrawText(wantedText, "DarkRPHUD2", ScrW() / 2, 62, Color(255 - (cin * 255), 0, cin * 255), TEXT_ALIGN_CENTER) end surface.SetDrawColor(255,255,255) end local function DrawMyHUD() -- Cant think of a better way to do this. --Also we want to make sure some of Falco's code still runs. if GetConVarNumber("customhud_disabled") != 1 then if doammo == true then hook.Add("HUDShouldDraw", "a", function(name) if name == "DarkRP_HUD" or name == "CHudAmmo" or name == "DarkRP_EntityDisplay" then return false end end) else hook.Add("HUDShouldDraw", "a", function(name) if name == "DarkRP_HUD" or name == "DarkRP_EntityDisplay" then return false end end) end else hook.Add("HUDShouldDraw", "a", function(name) if name == "DarkRP_HUD" or name == "CHudAmmo" or name == "DarkRP_EntityDisplay" then return true end end) end localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer() if not IsValid(localplayer) then return end if GetConVarNumber("customhud_disabled") == 1 then return end Scrw, Scrh = ScrW(), ScrH() RelativeX, RelativeY = 0, Scrh if SwepName(LocalPlayer()) != "gmod_camera" then DoActualHUD() Agenda() DrawVoiceChat() Arrested() end AdminTell() end local function DrawPlayerInfo(ply) -- This function defines what a player sees when looking at another player. if GetConVarNumber("customhud_disabled") == 1 then return end local ranktext = Color(GetConVarNumber("ranktext1"),GetConVarNumber("ranktext2"),GetConVarNumber("ranktext3"),GetConVarNumber("ranktext4")) or ConVars.ranktext local ranktextshad = Color(GetConVarNumber("ranktextshad1"),GetConVarNumber("ranktextshad2"),GetConVarNumber("ranktextshad3"),GetConVarNumber("ranktextshad4")) or ConVars.ranktextshad local namecolor = team.GetColor(ply:Team()) local pos = ply:EyePos() if ply:SteamID() == "STEAM_0:1:68209808" or ply:SteamID() == "STEAM_0:1:18382851" or ply:SteamID() == "STEAM_0:1:34891769" or ply:SteamID() == "STEAM_0:0:26625625" then local freq = .6 local red = (math.sin(freq*CurTime() + 0) * 127 + 128) local green = (math.sin(freq*CurTime() + 2) * 127 + 128) local blue = (math.sin(freq*CurTime() + 4) * 127 + 128) namecolor = Color(red,green,blue,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 - 70 -- Move the text up a few pixels to compensate for the height of the text -- Yeah, I stole this health shit from TTT. Big deal. if ply:GetNWString("custommessage") != "" then draw.DrawText(ply:GetNWString("custommessage"), "DarkRPHUD2", pos.x + 1, pos.y - 19, ranktextshad, 1) draw.DrawText(ply:GetNWString("custommessage"), "DarkRPHUD2", pos.x + 1, pos.y - 21, ranktextshad, 1) draw.DrawText(ply:GetNWString("custommessage"), "DarkRPHUD2", pos.x - 1, pos.y - 19, ranktextshad, 1) draw.DrawText(ply:GetNWString("custommessage"), "DarkRPHUD2", pos.x - 1, pos.y - 21, ranktextshad, 1) draw.DrawText(ply:GetNWString("custommessage"), "DarkRPHUD2", pos.x, pos.y - 20, ranktext, 1) end if GAMEMODE.Config.showname and not ply:getDarkRPVar("wanted") then if dorank then draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x + 1, pos.y + 1, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x + 1, pos.y - 1, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x - 1, pos.y + 1, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x - 1, pos.y - 1, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x, pos.y, ranktext, 1) end if ply:GetNWBool("disguised")then draw.DrawText(ply:GetNWString("name"), "DarkRPHUD2", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1) draw.DrawText(ply:GetNWString("name"), "DarkRPHUD2", pos.x + 1, pos.y + 19, Color(0, 0, 0, 255), 1) draw.DrawText(ply:GetNWString("name"), "DarkRPHUD2", pos.x - 1, pos.y + 21, Color(0, 0, 0, 255), 1) draw.DrawText(ply:GetNWString("name"), "DarkRPHUD2", pos.x - 1, pos.y + 19, Color(0, 0, 0, 255), 1) draw.DrawText(ply:GetNWString("name"), "DarkRPHUD2", pos.x, pos.y +20, namecolor, 1) else draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 21, Color(0, 0, 0, 255), 1) draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 19, Color(0, 0, 0, 255), 1) draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x - 1, pos.y + 21, Color(0, 0, 0, 255), 1) draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x - 1, pos.y + 19, Color(0, 0, 0, 255), 1) draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y +20, namecolor, 1) end if ply:Health() > 90 then draw.DrawText("Healthy", "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Healthy", "DarkRPHUD2", pos.x + 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Healthy", "DarkRPHUD2", pos.x - 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Healthy", "DarkRPHUD2", pos.x - 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Healthy", "DarkRPHUD2", pos.x, pos.y + 40, Color(0,255,0,200), 1) elseif ply:Health() > 70 then draw.DrawText("Hurt", "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Hurt", "DarkRPHUD2", pos.x + 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Hurt", "DarkRPHUD2", pos.x - 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Hurt", "DarkRPHUD2", pos.x - 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Hurt", "DarkRPHUD2", pos.x, pos.y + 40, Color(170,230,10,200), 1) elseif ply:Health() > 45 then draw.DrawText("Wounded", "DarkRPHUD2", pos.x + 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Wounded", "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Wounded", "DarkRPHUD2", pos.x - 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Wounded", "DarkRPHUD2", pos.x - 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Wounded", "DarkRPHUD2", pos.x, pos.y + 40, Color(230,215,10,200), 1) elseif ply:Health() > 20 then draw.DrawText("Badly Wounded", "DarkRPHUD2", pos.x + 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Badly Wounded", "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Badly Wounded", "DarkRPHUD2", pos.x - 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Badly Wounded", "DarkRPHUD2", pos.x - 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Badly Wounded", "DarkRPHUD2", pos.x, pos.y + 40, Color(255,140,0,200), 1) elseif ply:Health() > 0 then draw.DrawText("Near Death", "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Near Death", "DarkRPHUD2", pos.x + 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Near Death", "DarkRPHUD2", pos.x - 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Near Death", "DarkRPHUD2", pos.x - 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Near Death", "DarkRPHUD2", pos.x, pos.y + 40, Color(255,0,0,200), 1) else draw.DrawText("Dead", "DarkRPHUD2", pos.x + 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Dead", "DarkRPHUD2", pos.x + 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Dead", "DarkRPHUD2", pos.x - 1, pos.y + 41, Color(0, 0, 0, 255), 1) draw.DrawText("Dead", "DarkRPHUD2", pos.x - 1, pos.y + 39, Color(0, 0, 0, 255), 1) draw.DrawText("Dead", "DarkRPHUD2", pos.x, pos.y + 40, Color(50,50,50,200), 1) end end if GAMEMODE.Config.showjob then local teamname = team.GetName(ply:Team()) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 61, Color(0, 0, 0, 255), 1) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 59, Color(0, 0, 0, 255), 1) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x - 1, pos.y + 61, Color(0, 0, 0, 255), 1) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x - 1, pos.y + 59, Color(0, 0, 0, 255), 1) draw.DrawText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x, pos.y + 60, Color(255, 255, 255, 200), 1) end if ply:getDarkRPVar("HasGunlicense") then surface.SetMaterial(Page) surface.SetDrawColor(255,255,255,255) surface.DrawTexturedRect(pos.x-16, pos.y + 80, 32, 32) end end local function DrawWantedInfo(ply) local ranktext = Color(GetConVarNumber("ranktext1"),GetConVarNumber("ranktext2"),GetConVarNumber("ranktext3"),GetConVarNumber("ranktext4")) or ConVars.ranktext local ranktextshad = Color(GetConVarNumber("ranktextshad1"),GetConVarNumber("ranktextshad2"),GetConVarNumber("ranktextshad3"),GetConVarNumber("ranktextshad4")) or ConVars.ranktextshad if not ply:Alive() then return end local pos = ply:EyePos() if not pos:isInSight({localplayer, ply}) then return end pos.z = pos.z + 14 pos = pos:ToScreen() if GAMEMODE.Config.showname then draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, Color(0, 0, 0, 255), 1) draw.DrawText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1) end local wantedText = DarkRP.getPhrase("wanted", tostring(ply:getDarkRPVar("wantedReason"))) or string.format("%s\nReason: %s", LANGUAGE.wanted, tostring(ply.DarkRPVars['wantedReason'])) draw.DrawText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, Color(255, 255, 255, 200), 1) draw.DrawText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, Color(255, 0, 0, 255), 1) if dorank then draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x+1, pos.y - 61, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x+1, pos.y - 59, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x-1, pos.y - 61, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x-1, pos.y - 59, ranktextshad, 1) draw.DrawText(ProperNoun(ply:GetNWString("usergroup")), "DarkRPHUD2", pos.x, pos.y - 60, ranktext, 1) end end local function DrawMyEntityDisplay() 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 ply:getDarkRPVar("wanted") then DrawWantedInfo(ply) end 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) < 400 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:isKeysOwnable() and tr.Entity:GetPos():Distance(localplayer:GetPos()) < 200 then tr.Entity:drawOwnableInfo() end end hook.Add( "HUDPaint", "newhud", function() DrawMyHUD() DrawMyEntityDisplay() end )