Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hidehud(name)
- for k, v in pairs({"CHudHealth", "CHudBattery"}) do
- if name == v then return false end
- end
- end
- hook.Add("HUDShouldDraw", "HideOurHud:D", hidehud)
- surface.CreateFont("ello_font", { font = "Arial", size = 20, weight = 800 } )
- local function Base()
- local ply = LocalPlayer()
- local DrawHealth = LocalPlayer():Health()
- local DrawArmor = LocalPlayer():Armor()
- if DrawHealth > 100 then DrawHealth = 100 end
- if DrawHealth < 0 then DrawHealth = 0 end
- if DrawArmor > 100 then DrawArmor = 100 end
- if DrawArmor < 0 then DrawArmor = 0 end
- --If the variables table has not be initialized, initialize it
- LocalPlayer().DarkRPVars = LocalPlayer().DarkRPVars or {}
- --If the money is not set, don't do anything
- local v1 = LocalPlayer().DarkRPVars.money
- if not v1 then v1 = "" end
- --If the salary is not set, don't do anything
- local v2 = LocalPlayer().DarkRPVars.salary
- if not v2 then v2 = "" end
- draw.RoundedBox(6, (ScrW() / 15) -101 , ScrH() -45 , 570, 50, Color(40, 40, 40) )
- draw.RoundedBox(6, (ScrW() / 15) -101 , ScrH() -124 -10 , 210, 100, Color(40, 40, 40, 225) )
- draw.RoundedBox(2, (ScrW() / 15) -9.17 , ScrH() -37, 200-15, 30, Color(100, 100, 100) )
- draw.RoundedBox(0, (ScrW() / 15) -8, ScrH() -35, 200-20 , 30 - 4, Color(0,0,0) )
- if DrawHealth != 0 then
- draw.RoundedBox(0, (ScrW() / 15) -8, ScrH() -35, (200-20) * DrawHealth / 100 , 30 - 4, Color(255, 128, 0) )
- end
- draw.RoundedBox(2, (ScrW() / 15) -101 , ScrH() -134, 210, 3, Color(255, 128, 0) )
- draw.RoundedBox(2, (ScrW() / 15) -101 , ScrH() -45, 570, 3, Color(255, 128, 0) )
- draw.SimpleText("$" .. v1,'ello_font',(ScrW() / 15) -22,ScrH() - 105, Color(255, 128, 0))
- draw.SimpleText("Wallet", 'ello_font', (ScrW() / 15) -88, ScrH() - 105, Color(255, 128, 0) )
- draw.SimpleText("$" .. v2,'ello_font',(ScrW() / 15) -22,ScrH() - 85, Color(255, 128, 0) )
- draw.SimpleText("Salary", 'ello_font', (ScrW() / 15) -88, ScrH() - 85, Color(255, 128, 0) )
- draw.SimpleText(LocalPlayer().DarkRPVars.job,'ello_font',(ScrW() / 15) -22, ScrH() -65, Color(255, 128, 0))
- draw.SimpleText("Job", 'ello_font', (ScrW() / 15) -88, ScrH() - 65, Color(255, 128, 0) )
- draw.SimpleText( "" .. ply:Nick(), 'ello_font', (ScrW() / 15) -90, ScrH() -130, Color(255, 128, 0) )
- draw.SimpleText("Health", 'ello_font',(ScrW() / 15) -85, ScrH() -35, Color(255, 128, 0) )
- draw.RoundedBox(2,(ScrW() / 15) + 270, ScrH() -37, 200-15, 30, Color(100, 100, 100) )
- draw.RoundedBox(0,(ScrW() / 15) + 272, ScrH() -35, (200-20) , 30 - 4, Color(0, 0, 0) )
- if DrawArmor != 0 then
- draw.RoundedBox(0,(ScrW() / 15) + 272, ScrH() -35, (200-20) * DrawArmor / 100 , 30 - 4, Color(255, 128, 0) )
- end
- draw.RoundedBox(2, (ScrW() / 15) + 172 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 169 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 166 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 163 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 160 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 157 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 154 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 151 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 148 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 145 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 142 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 139 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 136 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 133 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 130 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 127 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 124 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 121 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 118 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 115 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 112 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 109 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 106 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 103 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 100 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 97 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 94 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 91 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 88 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 85 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 82 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 79 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2,(ScrW() / 15) + 76 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 73 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 70 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 67 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 64 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 61 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 58 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 55 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 52 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 49 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 46 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 43 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 40 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 37 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 34 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 31 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 28 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 25 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 22 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 19 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 16 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15)+ 13 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +10 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15)+ 7 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 4 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 1 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) -2 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) -5 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) -8, ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 452 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 449 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 446 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 443 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 440 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 437 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 434 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 431 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 428 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 425 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 422 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 419 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 416 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 413 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 410 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 407 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 404 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 401 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 398 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 395 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 392 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 389 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 386 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 383 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 380 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 377 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 374 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 371 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 368 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 365 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 362 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 359 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 356 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 353 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 350 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 347 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 344 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 341 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 338 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 335 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 332 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 329 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 326 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 323 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 320 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 317 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 314 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 311 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 308 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 305 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 302, ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 299, ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) + 296, ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +293 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +290 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +287 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +284 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +281 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +278 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +275 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.RoundedBox(2, (ScrW() / 15) +272 , ScrH() -35, 1.5, 26, Color(0,0,0) )
- draw.SimpleText("Armor", 'ello_font',(ScrW() / 15) + 195, ScrH() -35, Color(255, 128, 0) )
- draw.SimpleText("/100", 'ello_font',(ScrW() / 15) + 400, ScrH() -35, Color(255,255,255) )
- surface.SetFont( "ello_font")
- surface.SetTextColor(Color(255,255,255))
- surface.SetTextPos((ScrW() / 15) + 360,ScrH() -35)
- surface.DrawText("" .. ply:Armor() .. "")
- surface.SetFont( "ello_font")
- surface.SetTextColor(Color(255,255,255))
- surface.SetTextPos((ScrW() / 15) + 85,ScrH() -35)
- surface.DrawText("" .. ply:Health() .. "")
- draw.SimpleText("/100", 'ello_font', (ScrW() / 15) + 125,ScrH() -35, Color(255,255,255) )
- end
- /*---------------------------------------------------------------------------
- HUD ConVars
- ---------------------------------------------------------------------------*/
- local ConVars = {}
- local HUDWidth
- local HUDHeight
- local Color = Color
- local cvars = cvars
- local DarkRP = DarkRP
- local CurTime = CurTime
- local draw = draw
- local GetConVar = GetConVar
- 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
- CreateClientConVar("weaponhud", 0, true, false)
- local colors = {}
- colors.black = Color(0, 0, 0, 255)
- colors.blue = Color(0, 0, 255, 255)
- colors.brightred = Color(200, 30, 30, 255)
- colors.darkred = Color(0, 0, 70, 100)
- colors.darkblack = Color(0, 0, 0, 200)
- colors.gray1 = Color(0, 0, 0, 155)
- colors.gray2 = Color(51, 58, 51,100)
- colors.red = Color(255, 0, 0, 255)
- colors.white = Color(255, 255, 255, 255)
- colors.white1 = Color(255, 255, 255, 200)
- 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 Seperate Elements
- ---------------------------------------------------------------------------*/
- local Page = Material("icon16/page_white_text.png")
- local function GunLicense()
- if localplayer:getDarkRPVar("HasGunlicense") then
- surface.SetMaterial(Page)
- surface.SetDrawColor(255, 255, 255, 255)
- surface.DrawTexturedRect(RelativeX + HUDWidth, ScrH() - 34, 32, 32)
- end
- end
- local function Agenda()
- local ply = LocalPlayer()
- local agenda = ply:getAgendaTable()
- if not agenda then return end
- 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)
- local text = ply:getDarkRPVar("agenda") or ""
- text = text:gsub("//", "\n"):gsub("\\n", "\n")
- text = DarkRP.textWrap(text, "DarkRPHUD1", 440)
- draw.DrawNonParsedText(text, "DarkRPHUD1", 30, 35, colors.white, 0)
- end
- local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl")
- local function DrawVoiceChat()
- 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(ConVars.Healthforeground)
- surface.DrawTexturedRectRotated(ScrW() - 100, chboxY, Rotating*96, 96, backwards)
- end
- end
- CreateConVar("DarkRP_LockDown", 0, {FCVAR_REPLICATED, FCVAR_SERVER_CAN_EXECUTE})
- local function LockDown()
- local chbxX, chboxY = chat.GetChatBoxPos()
- if util.tobool(GetConVarNumber("DarkRP_LockDown")) then
- 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()
- if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
- draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil(ArrestedUntil - (CurTime() - StartArrested))), "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.Destroy("DarkRP_AdminTell")
- local Message = msg:ReadString()
- AdminTell = function()
- draw.RoundedBox(4, 10, 10, ScrW() - 20, 100, colors.darkblack)
- draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", ScrW() / 2 + 10, 10, colors.white, 1)
- draw.DrawNonParsedText(Message, "ChatFont", ScrW() / 2 + 10, 80, colors.brightred, 1)
- end
- timer.Create("DarkRP_AdminTell", 10, 1, function()
- AdminTell = function() end
- end)
- end)
- /*---------------------------------------------------------------------------
- Entity HUDPaint things
- ---------------------------------------------------------------------------*/
- local function DrawPlayerInfo(ply)
- local pos = ply:EyePos()
- pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
- pos = pos:ToScreen()
- pos.y = pos.y - 50 -- Move the text up a few pixels to compensate for the height of the text
- if GAMEMODE.Config.showname and not ply:getDarkRPVar("wanted") then
- draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
- draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1)
- end
- if GAMEMODE.Config.showhealth and not ply:getDarkRPVar("wanted") then
- draw.DrawNonParsedText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
- draw.DrawNonParsedText(DarkRP.getPhrase("health", ply:Health()), "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
- end
- if GAMEMODE.Config.showjob then
- local teamname = team.GetName(ply:Team())
- draw.DrawNonParsedText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
- draw.DrawNonParsedText(ply:getDarkRPVar("job") or teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
- end
- if ply:getDarkRPVar("HasGunlicense") then
- surface.SetMaterial(Page)
- surface.SetDrawColor(255,255,255,255)
- surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
- end
- end
- local function DrawWantedInfo(ply)
- 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.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
- draw.DrawNonParsedText(ply:Nick(), "DarkRPHUD2", pos.x, pos.y, team.GetColor(ply:Team()), 1)
- end
- local wantedText = DarkRP.getPhrase("wanted", tostring(ply: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 not ply:Alive() or ply == localplayer then continue end
- local hisPos = ply:GetShootPos()
- if ply:getDarkRPVar("wanted") then DrawWantedInfo(ply) end
- if GAMEMODE.Config.globalshow then
- DrawPlayerInfo(ply)
- -- Draw when you're (almost) looking at him
- elseif not GAMEMODE.Config.globalshow and 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 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
- /*---------------------------------------------------------------------------
- Drawing death notices
- ---------------------------------------------------------------------------*/
- function GAMEMODE:DrawDeathNotice(x, y)
- if not GAMEMODE.Config.showdeaths then return end
- self.BaseClass:DrawDeathNotice(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
- print(txt)
- 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 true
- end
- end
- /*---------------------------------------------------------------------------
- Disable players' names popping up when looking at them
- ---------------------------------------------------------------------------*/
- function GAMEMODE:HUDDrawTargetID()
- return false
- end
- /*---------------------------------------------------------------------------
- Actual HUDPaint hook
- ---------------------------------------------------------------------------*/
- function DrawHUD()
- localplayer = localplayer and IsValid(localplayer) and localplayer or LocalPlayer()
- if not IsValid(localplayer) then return end
- -- Custom
- Base()
- -- Default
- GunLicense()
- Agenda()
- DrawVoiceChat()
- LockDown()
- Arrested()
- AdminTell()
- DrawEntityDisplay()
- end
- hook.Add("HUDPaint", "DrawHUD", DrawHUD)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement