Advertisement
Guest User

Untitled

a guest
Aug 21st, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.85 KB | None | 0 0
  1. local function Base()
  2.  
  3.  
  4. local width1 = ScrW()
  5. local height1 = ScrH()
  6. local DrawHealth = LocalPlayer():Health() or 0
  7. local EchoHealth = LocalPlayer():Health() or 0
  8. local drawHealth2 = (width1 / 5) / 100 * DrawHealth
  9. local DrawArmour = LocalPlayer():Armor() or 0
  10. local EchoArmour = LocalPlayer():Armor() or 0
  11. local drawArmour2 = (width1 / 5) / 100 * DrawArmour or 0
  12. local NickName = LocalPlayer():Nick()
  13. draw.RoundedBox(6,18 ,703,380 ,180 ,Color(55,43,182,255))
  14. draw.RoundedBox(6,20 ,705,375 ,175 ,Color(135,206,235,245)) --Main box
  15.  
  16. draw.RoundedBox(6,45,height1 - 100 ,324,12,Color(0,0,0,255)) --Health outer box
  17. draw.RoundedBox(6,45,height1 - 70 ,324,12,Color(0,0,0,255)) --Armourouterbox 751
  18. draw.RoundedBox(6,width1 - 1557,height1 - 187,68,68,Color(55,43,182,255))
  19.  
  20.  
  21.  
  22.  
  23.  
  24. if DrawHealth > 100 then DrawHealth = 100 end
  25. if DrawHealth < 0 then DrawHealth = 0 end
  26. if DrawArmour >= 1 then
  27. draw.RoundedBox(6,47,height1 - 69,drawArmour2,10,Color(0,0,255,255)) --Armour
  28. end
  29. if DrawHealth >= 1 then
  30. draw.RoundedBox(6,47,height1 - 99 ,drawHealth2,10,Color(255,0,0,255)) --Health
  31. end
  32. draw.DrawText( "Armour:"..EchoArmour, "EquisFont", width1 - 1545, 812,Color(255,255,255))
  33. draw.DrawText( "Health:"..EchoHealth, "EquisFont", width1 - 1545, 780,Color(255,255,255))
  34.  
  35.  
  36. draw.DrawText(NickName,"EquisFont2",width1 - 1450,height1 - 170,Color(255,255,255))
  37. draw.DrawText("Money $"..LocalPlayer():getDarkRPVar( "money" ),"EquisFont2",width1 - 1420,height1 - 50,Color(255,255,255))
  38. draw.DrawText("Salary:"..LocalPlayer():getDarkRPVar( "salary" ),"EquisFont2",width1 - 1545,height1 - 50,Color(255,255,255))
  39. draw.DrawText("Job:"..LocalPlayer():getDarkRPVar( "job" ),"EquisFont2",width1 - 1375,height1 - 170,Color(255,255,255))
  40. draw.DrawText("Steam ID:"..LocalPlayer():SteamID(),"EquisFont2",width1 - 1450,height1 - 150,Color(255,255,255))
  41.  
  42.  
  43.  
  44.  
  45. local Avatar = vgui.Create( "AvatarImage", Panel )
  46. Avatar:SetSize( 64, 64 )
  47. Avatar:SetPos( width1 - 1555, height1 - 185 )
  48. Avatar:SetPlayer( LocalPlayer(), 64 )
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58. end
  59.  
  60. --[[---------------------------------------------------------------------------
  61. HUD ConVars
  62. ---------------------------------------------------------------------------]]
  63. local ConVars = {}
  64. local HUDWidth
  65. local HUDHeight
  66. local Color = Color
  67. local CurTime = CurTime
  68. local cvars = cvars
  69. local DarkRP = DarkRP
  70. local draw = draw
  71. local GetConVar = GetConVar
  72. local hook = hook
  73. local IsValid = IsValid
  74. local Lerp = Lerp
  75. local localplayer
  76. local math = math
  77. local pairs = pairs
  78. local ScrW, ScrH = ScrW, ScrH
  79. local SortedPairs = SortedPairs
  80. local string = string
  81. local surface = surface
  82. local table = table
  83. local timer = timer
  84. local tostring = tostring
  85. local plyMeta = FindMetaTable("Player")
  86. local DrawPicture = false
  87. local ply = LocalPlayer()
  88. local drawpic = false
  89.  
  90.  
  91. surface.CreateFont( "EquisFont", {
  92. font = "Tiki Tropic", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  93. extended = false,
  94. size = 20,
  95. weight = 500,
  96. blursize = 0,
  97. scanlines = 0,
  98. antialias = true,
  99. underline = false,
  100. italic = false,
  101. strikeout = false,
  102. symbol = false,
  103. rotary = false,
  104. shadow = false,
  105. additive = false,
  106. outline = false,
  107. } )
  108. surface.CreateFont( "EquisFont2", {
  109. font = "CrashLanding BB", -- Use the font-name which is shown to you by your operating system Font Viewer, not the file name
  110. extended = false,
  111. size = 20,
  112. weight = 500,
  113. blursize = 0,
  114. scanlines = 0,
  115. antialias = true,
  116. underline = false,
  117. italic = false,
  118. strikeout = false,
  119. symbol = false,
  120. rotary = false,
  121. shadow = false,
  122. additive = false,
  123. outline = false,
  124. } )
  125. local function ReloadConVars()
  126. ConVars = {
  127. background = {0,0,0,100},
  128. Healthbackground = {0,0,0,200},
  129. Healthforeground = {140,0,0,180},
  130. HealthText = {255,255,255,200},
  131. Job1 = {0,0,150,200},
  132. Job2 = {0,0,0,255},
  133. salary1 = {0,150,0,200},
  134. salary2 = {0,0,0,255}
  135. }
  136.  
  137. for name, Colour in pairs(ConVars) do
  138. ConVars[name] = {}
  139. for num, rgb in SortedPairs(Colour) do
  140. local CVar = GetConVar(name .. num) or CreateClientConVar(name .. num, rgb, true, false)
  141. table.insert(ConVars[name], CVar:GetInt())
  142.  
  143. if not cvars.GetConVarCallbacks(name .. num, false) then
  144. cvars.AddChangeCallback(name .. num, function()
  145. timer.Simple(0, ReloadConVars)
  146. end)
  147. end
  148. end
  149. ConVars[name] = Color(unpack(ConVars[name]))
  150. end
  151.  
  152.  
  153. HUDWidth = (GetConVar("HudW") or CreateClientConVar("HudW", 240, true, false)):GetInt()
  154. HUDHeight = (GetConVar("HudH") or CreateClientConVar("HudH", 115, true, false)):GetInt()
  155.  
  156. if not cvars.GetConVarCallbacks("HudW", false) and not cvars.GetConVarCallbacks("HudH", false) then
  157. cvars.AddChangeCallback("HudW", function() timer.Simple(0,ReloadConVars) end)
  158. cvars.AddChangeCallback("HudH", function() timer.Simple(0,ReloadConVars) end)
  159. end
  160. end
  161. ReloadConVars()
  162.  
  163. local Scrw, Scrh, RelativeX, RelativeY
  164. --[[---------------------------------------------------------------------------
  165. HUD separate Elements
  166. ---------------------------------------------------------------------------]]
  167.  
  168. local function GunLicense()
  169. if LocalPlayer():getDarkRPVar("HasGunlicense") then
  170. draw.RoundedBox(6,500,500,50,50,Color(255,255,125))
  171. end
  172. end
  173. local agendaText
  174. local function Agenda()
  175.  
  176. local agenda = LocalPlayer():getAgendaTable()
  177. if not agenda then return end
  178. agendaText = agendaText or DarkRP.textWrap((localplayer:getDarkRPVar("agenda") or ""):gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
  179.  
  180. draw.RoundedBox(10, 10, 10, 460, 110, colors.gray1)
  181. draw.RoundedBox(10, 12, 12, 456, 106, colors.gray2)
  182. draw.RoundedBox(10, 12, 12, 456, 20, colors.darkred)
  183.  
  184. draw.DrawNonParsedText(agenda.Title, "DarkRPHUD1", 30, 12, colors.red, 0)
  185. draw.DrawNonParsedText(agendaText, "DarkRPHUD1", 30, 35, colors.white, 0)
  186. end
  187.  
  188. hook.Add("DarkRPVarChanged", "agendaHUD", function(ply, var, _, new)
  189. if ply ~= localplayer then return end
  190. if var == "agenda" and new then
  191. agendaText = DarkRP.textWrap(new:gsub("//", "\n"):gsub("\\n", "\n"), "DarkRPHUD1", 440)
  192. else
  193. agendaText = nil
  194. end
  195.  
  196. if var == "salary" then
  197. salaryText = DarkRP.getPhrase("salary", DarkRP.formatMoney(new), "")
  198. end
  199.  
  200. if var == "job" or var == "money" then
  201. JobWalletText = string.format("%s\n%s",
  202. DarkRP.getPhrase("job", var == "job" and new or localplayer:getDarkRPVar("job") or ""),
  203. DarkRP.getPhrase("wallet", var == "money" and DarkRP.formatMoney(new) or DarkRP.formatMoney(localplayer:getDarkRPVar("money")), "")
  204. )
  205. end
  206. end)
  207.  
  208. local VoiceChatTexture = surface.GetTextureID("voice/icntlk_pl")
  209. local function DrawVoiceChat()
  210. if LocalPlayer().DRPIsTalking then
  211. local _, chboxY = chat.GetChatBoxPos()
  212.  
  213. local Rotating = math.sin(CurTime() * 3)
  214. local backwards = 0
  215.  
  216. if Rotating < 0 then
  217. Rotating = 1 - (1 + Rotating)
  218. backwards = 180
  219. end
  220.  
  221. surface.SetTexture(VoiceChatTexture)
  222. surface.SetDrawColor(ConVars.Healthforeground)
  223. surface.DrawTexturedRectRotated(Scrw - 100, chboxY, Rotating * 96, 96, backwards)
  224. end
  225. end
  226.  
  227. local function LockDown()
  228. local chbxX, chboxY = chat.GetChatBoxPos()
  229. if GetGlobalBool("DarkRP_LockDown") then
  230. local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_LockdownHUD")
  231. if shouldDraw == false then return end
  232. local cin = (math.sin(CurTime()) + 1) / 2
  233. local chatBoxSize = math.floor(Scrh / 4)
  234. draw.DrawNonParsedText(DarkRP.getPhrase("lockdown_started"), "ScoreboardSubtitle", chbxX, chboxY + chatBoxSize, Color(cin * 255, 0, 255 - (cin * 255), 255), TEXT_ALIGN_LEFT)
  235. end
  236. end
  237.  
  238. local Arrested = function() end
  239.  
  240. usermessage.Hook("GotArrested", function(msg)
  241. local StartArrested = CurTime()
  242. local ArrestedUntil = msg:ReadFloat()
  243.  
  244. Arrested = function()
  245. local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_ArrestedHUD")
  246. if shouldDraw == false then return end
  247.  
  248. if CurTime() - StartArrested <= ArrestedUntil and localplayer:getDarkRPVar("Arrested") then
  249. draw.DrawNonParsedText(DarkRP.getPhrase("youre_arrested", math.ceil((ArrestedUntil - (CurTime() - StartArrested)) * 1 / game.GetTimeScale())), "DarkRPHUD1", Scrw / 2, Scrh - Scrh / 12, colors.white, 1)
  250. elseif not localplayer:getDarkRPVar("Arrested") then
  251. Arrested = function() end
  252. end
  253. end
  254. end)
  255.  
  256. local AdminTell = function() end
  257.  
  258. usermessage.Hook("AdminTell", function(msg)
  259. timer.Remove("DarkRP_AdminTell")
  260. local Message = msg:ReadString()
  261.  
  262. AdminTell = function()
  263. draw.RoundedBox(4, 10, 10, Scrw - 20, 110, colors.darkblack)
  264. draw.DrawNonParsedText(DarkRP.getPhrase("listen_up"), "GModToolName", Scrw / 2 + 10, 10, colors.white, 1)
  265. draw.DrawNonParsedText(Message, "ChatFont", Scrw / 2 + 10, 90, colors.brightred, 1)
  266. end
  267.  
  268. timer.Create("DarkRP_AdminTell", 10, 1, function()
  269. AdminTell = function() end
  270. end)
  271. end)
  272.  
  273.  
  274.  
  275. --[[---------------------------------------------------------------------------
  276. Entity HUDPaint things
  277. ---------------------------------------------------------------------------]]
  278. -- Draw a player's name, health and/or job above the head
  279. -- This syntax allows for easy overriding
  280. plyMeta.drawPlayerInfo = plyMeta.drawPlayerInfo or function(self)
  281. local pos = self:EyePos()
  282.  
  283. pos.z = pos.z + 10 -- The position we want is a bit above the position of the eyes
  284. pos = pos:ToScreen()
  285. if not self:getDarkRPVar("wanted") then
  286. -- Move the text up a few pixels to compensate for the height of the text
  287. pos.y = pos.y - 50
  288. end
  289.  
  290. if GAMEMODE.Config.showname then
  291. local nick, plyTeam = self:Nick(), self:Team()
  292. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  293. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  294. end
  295.  
  296. if GAMEMODE.Config.showhealth then
  297. local health = DarkRP.getPhrase("health", self:Health())
  298. draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x + 1, pos.y + 21, colors.black, 1)
  299. draw.DrawNonParsedText(health, "DarkRPHUD2", pos.x, pos.y + 20, colors.white1, 1)
  300. end
  301.  
  302. if GAMEMODE.Config.showjob then
  303. local teamname = self:getDarkRPVar("job") or team.GetName(self:Team())
  304. draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x + 1, pos.y + 41, colors.black, 1)
  305. draw.DrawNonParsedText(teamname, "DarkRPHUD2", pos.x, pos.y + 40, colors.white1, 1)
  306. end
  307.  
  308. if self:getDarkRPVar("HasGunlicense") then
  309. surface.SetMaterial(Page)
  310. surface.SetDrawColor(255,255,255,255)
  311. surface.DrawTexturedRect(pos.x-16, pos.y + 60, 32, 32)
  312. end
  313. end
  314.  
  315. -- Draw wanted information above a player's head
  316. -- This syntax allows for easy overriding
  317. plyMeta.drawWantedInfo = plyMeta.drawWantedInfo or function(self)
  318. if not self:Alive() then return end
  319.  
  320. local pos = self:EyePos()
  321. if not pos:isInSight({localplayer, self}) then return end
  322.  
  323. pos.z = pos.z + 10
  324. pos = pos:ToScreen()
  325.  
  326. if GAMEMODE.Config.showname then
  327. local nick, plyTeam = self:Nick(), self:Team()
  328. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x + 1, pos.y + 1, colors.black, 1)
  329. draw.DrawNonParsedText(nick, "DarkRPHUD2", pos.x, pos.y, RPExtraTeams[plyTeam] and RPExtraTeams[plyTeam].color or team.GetColor(plyTeam) , 1)
  330. end
  331.  
  332. local wantedText = DarkRP.getPhrase("wanted", tostring(self:getDarkRPVar("wantedReason")))
  333.  
  334. draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x, pos.y - 40, colors.white1, 1)
  335. draw.DrawNonParsedText(wantedText, "DarkRPHUD2", pos.x + 1, pos.y - 41, colors.red, 1)
  336. end
  337.  
  338. --[[---------------------------------------------------------------------------
  339. The Entity display: draw HUD information about entities
  340. ---------------------------------------------------------------------------]]
  341. local function DrawEntityDisplay()
  342.  
  343.  
  344. local shootPos = LocalPlayer():GetShootPos()
  345. local aimVec = LocalPlayer():GetAimVector()
  346.  
  347. for k, ply in pairs(players or player.GetAll()) do
  348. if ply == localplayer or not ply:Alive() or ply:GetNoDraw() then continue end
  349. local hisPos = ply:GetShootPos()
  350. if ply:getDarkRPVar("wanted") then ply:drawWantedInfo() end
  351.  
  352. if GAMEMODE.Config.globalshow then
  353. ply:drawPlayerInfo()
  354. -- Draw when you're (almost) looking at him
  355. elseif hisPos:DistToSqr(shootPos) < 160000 then
  356. local pos = hisPos - shootPos
  357. local unitPos = pos:GetNormalized()
  358. if unitPos:Dot(aimVec) > 0.95 then
  359. local trace = util.QuickTrace(shootPos, pos, localplayer)
  360. if trace.Hit and trace.Entity ~= ply then break end
  361. ply:drawPlayerInfo()
  362. end
  363. end
  364. end
  365.  
  366. local tr = LocalPlayer():GetEyeTrace()
  367.  
  368. if IsValid(tr.Entity) and tr.Entity:isKeysOwnable() and tr.Entity:GetPos():DistToSqr(localplayer:GetPos()) < 40000 then
  369. tr.Entity:drawOwnableInfo()
  370. end
  371. end
  372.  
  373. --[[---------------------------------------------------------------------------
  374. Drawing death notices
  375. ---------------------------------------------------------------------------]]
  376. function GAMEMODE:DrawDeathNotice(x, y)
  377. if not GAMEMODE.Config.showdeaths then return end
  378. self.Sandbox.DrawDeathNotice(self, x, y)
  379. end
  380.  
  381. --[[---------------------------------------------------------------------------
  382. Display notifications
  383. ---------------------------------------------------------------------------]]
  384. local function DisplayNotify(msg)
  385. local txt = msg:ReadString()
  386. GAMEMODE:AddNotify(txt, msg:ReadShort(), msg:ReadLong())
  387. surface.PlaySound("buttons/lightswitch2.wav")
  388.  
  389. -- Log to client console
  390. MsgC(Color(255, 20, 20, 255), "[DarkRP] ", Color(200, 200, 200, 255), txt, "\n")
  391. end
  392. usermessage.Hook("_Notify", DisplayNotify)
  393.  
  394. --[[---------------------------------------------------------------------------
  395. Remove some elements from the HUD in favour of the DarkRP HUD
  396. ---------------------------------------------------------------------------]]
  397. function GAMEMODE:HUDShouldDraw(name)
  398. if name == "CHudHealth" or
  399. name == "CHudBattery" or
  400. name == "CHudSuitPower" or
  401. (HelpToggled and name == "CHudChat") then
  402. return false
  403. else
  404. return self.Sandbox.HUDShouldDraw(self, name)
  405. end
  406. end
  407.  
  408. --[[---------------------------------------------------------------------------
  409. Disable players' names popping up when looking at them
  410. ---------------------------------------------------------------------------]]
  411. function GAMEMODE:HUDDrawTargetID()
  412. return false
  413. end
  414.  
  415. --[[---------------------------------------------------------------------------
  416. Actual HUDPaint hook
  417. ---------------------------------------------------------------------------]]
  418. function DrawHUD()
  419.  
  420.  
  421. local shouldDraw = hook.Call("HUDShouldDraw", GAMEMODE, "DarkRP_HUD")
  422. if shouldDraw == false then return end
  423.  
  424.  
  425.  
  426.  
  427.  
  428. --cust2om
  429.  
  430.  
  431. Base()
  432. --default
  433.  
  434. GunLicense()
  435. Agenda()
  436. DrawVoiceChat()
  437. LockDown()
  438. Arrested()
  439. AdminTell()
  440. DrawEntityDisplay()
  441.  
  442. end
  443.  
  444. hook.Add("HUDPaint", "DrawHUD", DrawHUD)
  445.  
  446. --You steal this hud you're a dick from Ambient
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement