Advertisement
Guest User

murder edit

a guest
Oct 1st, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.75 KB | None | 0 0
  1.  
  2. surface.CreateFont( "MersText1" , {
  3. font = "Tahoma",
  4. size = 16,
  5. weight = 1000,
  6. antialias = true,
  7. italic = false
  8. })
  9.  
  10. surface.CreateFont( "MersHead1" , {
  11. font = "coolvetica",
  12. size = 24,
  13. weight = 500,
  14. antialias = true,
  15. italic = false
  16. })
  17.  
  18. surface.CreateFont( "MersRadial" , {
  19. font = "coolvetica",
  20. size = math.ceil(ScrW() / 34),
  21. weight = 500,
  22. antialias = true,
  23. italic = false
  24. })
  25.  
  26. surface.CreateFont( "MersRadialBig" , {
  27. font = "coolvetica",
  28. size = math.ceil(ScrW() / 24),
  29. weight = 500,
  30. antialias = true,
  31. italic = false
  32. })
  33.  
  34. surface.CreateFont( "MersRadialSmall" , {
  35. font = "coolvetica",
  36. size = math.ceil(ScrW() / 60),
  37. weight = 100,
  38. antialias = true,
  39. italic = false
  40. })
  41.  
  42. surface.CreateFont( "MersDeathBig" , {
  43. font = "coolvetica",
  44. size = math.ceil(ScrW() / 18),
  45. weight = 500,
  46. antialias = true,
  47. italic = false
  48. })
  49.  
  50. local function drawTextShadow(t,f,x,y,c,px,py)
  51. color_black.a = c.a
  52. draw.SimpleText(t,f,x + 1,y + 1,color_black,px,py)
  53. draw.SimpleText(t,f,x,y,c,px,py)
  54. color_black.a = 255
  55. end
  56.  
  57.  
  58. local healthCol = Color(120,255,20)
  59. function GM:HUDPaint()
  60. local round = self:GetRound()
  61. local client = LocalPlayer()
  62.  
  63. if round == 0 then
  64. drawTextShadow(translate.minimumPlayers, "MersRadial", ScrW() / 2, ScrH() - 10, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP)
  65. end
  66.  
  67. if client:Team() == 2 then
  68. if !client:Alive() then
  69. self:RenderRespawnText()
  70. else
  71.  
  72. if round == 1 then
  73. if self.RoundStart && self.RoundStart + 10 > CurTime() then
  74. self:DrawStartRoundInformation()
  75. else
  76. self:DrawGameHUD(LocalPlayer())
  77. end
  78. elseif round == 2 then
  79. // display who won
  80. self:DrawGameHUD(LocalPlayer())
  81. else // round = 0
  82.  
  83. end
  84.  
  85. -- local tr = LocalPlayer():GetEyeTrace()
  86.  
  87. -- local lc = render.GetLightColor(LocalPlayer():GetPos() + Vector(0,0,30))
  88. -- local lt = (lc.r + lc.g + lc.b) / 3
  89. -- draw.DrawText("Light:" .. tostring(lc), "MersRadial", ScrW() - 20, 80, color_white, 2)
  90. -- draw.DrawText("Average:" .. tostring(math.Round(lt * 100) / 100), "MersRadial", ScrW() - 20, 120, color_white, 2)
  91. end
  92. else
  93. self:RenderSpectate()
  94. end
  95.  
  96. if self.Debug:GetBool() then
  97. local h = draw.GetFontHeight("MersRadial")
  98. local y = 0
  99.  
  100. draw.DrawText("Footsteps: " .. table.Count(FootStepsG), "MersRadial", ScrW() - 20, 20 + y, color_white, 2)
  101. y = y + h
  102. end
  103.  
  104. self:DrawRadialMenu()
  105. end
  106.  
  107. function GM:DrawStartRoundInformation()
  108. local client = LocalPlayer()
  109. local t1 = translate.startHelpBystanderTitle
  110. local t2 = nil
  111. local c = Color(20,120,255)
  112. local desc = translate.table.startHelpBystander
  113.  
  114. if self:GetAmMurderer() then
  115. t1 = translate.startHelpMurdererTitle
  116. desc = translate.table.startHelpMurderer
  117. c = Color(190, 20, 20)
  118. end
  119.  
  120. local hasMagnum = false
  121. for k, wep in pairs(client:GetWeapons()) do
  122. if wep:GetClass() == "weapon_mu_magnum" then
  123. hasMagnum = true
  124. break
  125. end
  126. end
  127. if hasMagnum then
  128. t1 = translate.startHelpGunTitle
  129. t2 = translate.startHelpGunSubtitle
  130. desc = translate.table.startHelpGun
  131. end
  132.  
  133. drawTextShadow(t1, "MersRadial", ScrW() / 2, ScrH() * 0.25, c, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  134. if t2 then
  135. local h = draw.GetFontHeight("MersRadial")
  136. drawTextShadow(t2, "MersRadialSmall", ScrW() / 2, ScrH() * 0.25 + h * 0.7, Color(120, 70, 245), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  137. end
  138.  
  139. if desc then
  140. local fontHeight = draw.GetFontHeight("MersRadialSmall")
  141. for k,v in pairs(desc) do
  142. drawTextShadow(v, "MersRadialSmall", ScrW() / 2, ScrH() * 0.75 + (k - 1) * fontHeight, c, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  143. end
  144. end
  145. end
  146.  
  147. local tex = surface.GetTextureID("SGM/playercircle")
  148. local gradR = surface.GetTextureID("gui/gradient")
  149.  
  150. local function colorDif(col1, col2)
  151. local x = col1.x - col2.x
  152. local y = col1.y - col2.y
  153. local z = col1.z - col2.z
  154. x = x > 0 and x or -x
  155. y = y > 0 and y or -y
  156. z = z > 0 and z or -z
  157. return x + y + z
  158. end
  159.  
  160. function GM:DrawGameHUD(ply)
  161. if !IsValid(ply) then return end
  162. local health = ply:Health()
  163. if !IsValid(ply) then return end
  164.  
  165. local shouldDraw = hook.Run("HUDShouldDraw", "MurderMurdererFog")
  166. if shouldDraw != false then
  167. if LocalPlayer() == ply && ply:GetNWBool("MurdererFog") && self:GetAmMurderer() then
  168. surface.SetDrawColor(10,10,10,50)
  169. surface.DrawRect(-1, -1, ScrW() + 2, ScrH() + 2)
  170.  
  171. drawTextShadow(translate.murdererFog, "MersRadial", ScrW() * 0.5, ScrH() - 80, Color(90,20,20), 1, TEXT_ALIGN_CENTER)
  172. drawTextShadow(translate.murdererFogSub, "MersRadialSmall", ScrW() * 0.5, ScrH() - 50, Color(130,130,130), 1, TEXT_ALIGN_CENTER)
  173. end
  174. end
  175.  
  176. -- surface.SetFont("MersRadial")
  177. -- local w,h = surface.GetTextSize("Health")
  178.  
  179. -- drawTextShadow("Health", "MersRadial", 20, ScrH() - 10, healthCol, 0, TEXT_ALIGN_TOP)
  180. -- drawTextShadow(health, "MersRadialBig", 20 + w + 10, ScrH() - 10 + 3, healthCol, 0, TEXT_ALIGN_TOP)
  181.  
  182. local shouldDraw = hook.Run("HUDShouldDraw", "MurderPlayerType")
  183. if shouldDraw != false then
  184. local name = translate.bystander
  185. local color = Color(20,120,255)
  186.  
  187. if LocalPlayer() == ply && self:GetAmMurderer() then
  188. name = translate.murderer
  189. color = Color(190, 20, 20)
  190. end
  191.  
  192. drawTextShadow(name, "MersRadial", ScrW() - 20, ScrH() - 10, color, 2, TEXT_ALIGN_TOP)
  193. end
  194.  
  195. local tr = ply:GetEyeTraceNoCursor()
  196.  
  197. local shouldDraw = hook.Run("HUDShouldDraw", "MurderPlayerNames")
  198. if shouldDraw != false then
  199. // draw names
  200. if IsValid(tr.Entity) && (tr.Entity:IsPlayer() || tr.Entity:GetClass() == "prop_ragdoll") && tr.HitPos:Distance(tr.StartPos) < 500 then
  201. self.LastLooked = tr.Entity
  202. self.LookedFade = CurTime()
  203. end
  204. if IsValid(self.LastLooked) && self.LookedFade + 2 > CurTime() then
  205. local name = self.LastLooked:GetBystanderName() or "error"
  206. local col = self.LastLooked:GetPlayerColor() or Vector()
  207. col = Color(col.x * 255, col.y * 255, col.z * 255)
  208. col.a = (1 - (CurTime() - self.LookedFade) / 2) * 255
  209. drawTextShadow(name, "MersRadial", ScrW() / 2, ScrH() / 2 + 80, col, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  210. end
  211. end
  212.  
  213. local shouldDraw = hook.Run("HUDShouldDraw", "MurderDisguise")
  214. if shouldDraw != false then
  215. if self:GetAmMurderer() && self.LootCollected && self.LootCollected >= 1 then
  216. if IsValid(tr.Entity) && tr.Entity:GetClass() == "prop_ragdoll" && tr.HitPos:Distance(tr.StartPos) < 80 then
  217. if tr.Entity:GetBystanderName() != ply:GetBystanderName() || colorDif(tr.Entity:GetPlayerColor(), ply:GetPlayerColor()) > 0.1 then
  218. local h = draw.GetFontHeight("MersRadial")
  219. drawTextShadow("[E] Disguise as for 1 loot", "MersRadialSmall", ScrW() / 2, ScrH() / 2 + 80 + h * 0.7, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  220. end
  221. end
  222. end
  223. end
  224.  
  225. local shouldDraw = hook.Run("HUDShouldDraw", "MurderHealthBall")
  226. if shouldDraw != false then
  227. // setup size
  228. local size = ScrW() * 0.08
  229.  
  230. // draw black circle
  231.  
  232. // draw health circle
  233. surface.SetTexture(tex)
  234. local col = ply:GetPlayerColor()
  235. col = Color(col.x * 255, col.y * 255, col.z * 255)
  236. surface.SetDrawColor(col)
  237. local hsize = math.Clamp(health, 0, 100) / 100 * size
  238.  
  239.  
  240. if LocalPlayer() == ply then
  241.  
  242. end
  243.  
  244. surface.SetFont("MersRadialSmall")
  245. local w,h = surface.GetTextSize(ply:GetBystanderName())
  246. local x = math.max(size * 0.6 + w / -2, size * 0.1)
  247. drawTextShadow(ply:GetBystanderName(), "MersRadialSmall", x, ScrH() - size * 1.1, col, 0, TEXT_ALIGN_TOP)
  248. end
  249.  
  250. local shouldDraw = hook.Run("HUDShouldDraw", "MurderFlashlightCharge")
  251. if shouldDraw != false then
  252. if LocalPlayer() == ply && (ply:FlashlightIsOn() || self:GetFlashlightCharge() < 1) then
  253. local size = ScrW() * 0.08
  254. local x = size * 1.2
  255.  
  256. local w = ScrW() * 0.08
  257. local h = ScrH() * 0.03
  258.  
  259. local bord = math.Round(ScrW() * 0.08 * 0.03)
  260. if ply:FlashlightIsOn() then
  261. surface.SetDrawColor(0, 0, 0, 240)
  262. else
  263. surface.SetDrawColor(5, 5, 5, 180)
  264. end
  265. surface.DrawRect(x, ScrH() - h - size * 0.2, w, h)
  266.  
  267. local charge = self:GetFlashlightCharge()
  268.  
  269. if ply:FlashlightIsOn() then
  270. surface.SetDrawColor(50, 180, 220, 240)
  271. else
  272. surface.SetDrawColor(50, 180, 220, 180)
  273. end
  274. surface.DrawRect(x + bord, ScrH() - h - size * 0.2 + bord, (w - bord * 2) * charge, h - bord * 2)
  275.  
  276. surface.SetTexture(gradR)
  277. surface.SetDrawColor(255, 255, 255, 50)
  278. surface.DrawTexturedRect(x + bord, ScrH() - h - size * 0.2 + bord, (w - bord * 2) * charge, h - bord * 2)
  279. end
  280. end
  281. end
  282.  
  283. function GM:GUIMousePressed(code, vector)
  284. end
  285.  
  286. function GM:RenderScreenspaceEffects()
  287. local client = LocalPlayer()
  288. if !client:Alive() then
  289. self:RenderDeathOverlay()
  290. end
  291.  
  292. if self:GetRound() == 1 && self.RoundStart && self.RoundStart + 10 > CurTime() then
  293. local sw, sh = ScrW(), ScrH()
  294. surface.SetDrawColor(0,0,0,255)
  295. surface.DrawRect(-1,-1,sw + 2,sh + 2)
  296. end
  297.  
  298.  
  299. end
  300.  
  301. function GM:PostDrawHUD()
  302. if self:GetRound() == 1 then
  303. local dest = 0
  304. if self.TKerPenalty then
  305. -- dest = (math.sin(CurTime()) + 1) * 30 / 2 + 230
  306. dest = 254
  307. end
  308. self.ScreenDarkness = math.Clamp(math.Approach(self.ScreenDarkness or 0, dest, FrameTime() * 120), 0, 255)
  309.  
  310. if self.ScreenDarkness > 0 then
  311. local sw, sh = ScrW(), ScrH()
  312. surface.SetDrawColor(0,0,0, self.ScreenDarkness)
  313. surface.DrawRect(-1, -1, sw + 2, sh + 2)
  314. end
  315. else
  316. self.ScreenDarkness = 0
  317. end
  318. end
  319.  
  320. function GM:HUDShouldDraw( name )
  321. // hide health and armor
  322. if name == "CHudHealth" || name == "CHudBattery" then
  323. return false
  324. end
  325.  
  326. // allow weapon hiding
  327. local ply = LocalPlayer()
  328. if IsValid(ply) then
  329. local wep = ply:GetActiveWeapon()
  330. if IsValid(wep) && wep.HUDShouldDraw then
  331. return wep.HUDShouldDraw(wep, name)
  332. end
  333. end
  334.  
  335. return true
  336. end
  337.  
  338. function GM:GUIMousePressed(code, vector)
  339. return self:RadialMousePressed(code,vector)
  340. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement