Advertisement
r4k0

Untitled

Aug 23rd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. hook.Add( "CalcView", "CalcView.MedicMod", function( ply, pos, ang, fov )
  2. if ( !IsValid( ply ) or !ply:Alive() or ply:GetViewEntity() != ply ) then return end
  3. if ply:GetMedicAnimation() == 0 then return end
  4.  
  5. local view = {}
  6.  
  7. view.origin = pos - ( ang:Forward()*20 )
  8. view.angles = ang
  9. view.fov = fov
  10. view.drawviewer = true
  11.  
  12. return view
  13.  
  14. end)
  15.  
  16. hook.Add("RenderScreenspaceEffects", "RenderScreenspaceEffects.MedicMod", function()
  17. if LocalPlayer():IsBleeding() then
  18. MedicMod.BleedingEffect()
  19. end
  20. if LocalPlayer():IsPoisoned() then
  21. MedicMod.PoisonEffect()
  22. end
  23. end)
  24.  
  25. local bleedingIcon = Material("materials/bleeding.png")
  26. local poisonedIcon = Material("materials/poisoned.png")
  27. local hattackIcon = Material("materials/heart_attack_icon.png")
  28. local morphIcon = Material("materials/morphine_icon.png")
  29. local breakIcon = Material("materials/break_icon.png")
  30. local notifIcon = Material("materials/heart_attack_icon.png")
  31.  
  32. local deathPanel = nil
  33.  
  34. hook.Add("HUDPaint", "HUDPaint.MedicMod", function()
  35.  
  36. if ConfigurationMedicMod.MedicTeams and table.HasValue(ConfigurationMedicMod.MedicTeams, LocalPlayer():Team()) then
  37. for k, v in pairs(ents.FindByClass("prop_ragdoll")) do
  38.  
  39. if not v:IsDeathRagdoll() then continue end
  40.  
  41. local pos = ( v:GetPos() + Vector(0,0,10) ):ToScreen()
  42. local dist = v:GetPos():Distance(LocalPlayer():GetPos())
  43.  
  44. surface.SetDrawColor( 255, 255, 255, 255 )
  45. surface.SetMaterial( notifIcon )
  46. surface.DrawTexturedRect( pos.x - 25, pos.y, 50, 50 )
  47.  
  48. draw.SimpleTextOutlined( math.floor(math.sqrt(dist/3)).."m", "MedicModFont30", pos.x, pos.y + 50, Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
  49.  
  50. end
  51. end
  52.  
  53. if not LocalPlayer():Alive() and not IsValid(deathPanel) and MedicMod.seconds then
  54. deathPanel = vgui.Create("DFrame")
  55. deathPanel:SetSize(ScrW()*0.25, ScrH()*0.125)
  56. deathPanel:SetTitle("")
  57. deathPanel:SetAlpha(0)
  58. deathPanel:AlphaTo(255,1.2)
  59. deathPanel:Center()
  60. deathPanel:ShowCloseButton(false)
  61. deathPanel.Paint = function(s,w,h)
  62. draw.RoundedBox(0, 0, 0, w, h, Color(102, 207, 255))
  63. draw.RoundedBox(0, 0, 0, w, h*0.20, Color(0, 157, 230))
  64. draw.SimpleText(ConfigurationMedicMod.Sentences["Death Notice"][ConfigurationMedicMod.Language].." - Medic Mod", "MedicModFont17", w/2, h*0.20/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  65. draw.SimpleText(ConfigurationMedicMod.Sentences["You have lost consciousness."][ConfigurationMedicMod.Language],"MedicModFont17",w/2,h/2-17.5,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  66. draw.SimpleText(ConfigurationMedicMod.Sentences["You must be rescued by a medic, or wait."][ConfigurationMedicMod.Language] ,"MedicModFont17",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  67. end
  68. deathPanel.Think = function(s)
  69. if LocalPlayer():Alive() then
  70. s:AlphaTo(0, 1.2, 0, function(data,pnl) pnl:Remove() end)
  71. end
  72. end
  73. local x,y = deathPanel:GetSize()
  74. local button1 = vgui.Create("DButton",deathPanel)
  75. button1:Dock(BOTTOM)
  76. button1:SetText("")
  77. button1:SetSize(0,y*0.25)
  78. button1.DoClick = function(s)
  79. if MedicMod.seconds-CurTime() > 0 then return end
  80. net.Start("MedicMod.Respawn")
  81. net.SendToServer()
  82. end
  83. button1.Paint = function(s,w,h)
  84. draw.RoundedBox(8, 0, 0, w, h, Color(0, 157, 230))
  85. if MedicMod.seconds-CurTime() > 0 then
  86. draw.SimpleText(ConfigurationMedicMod.Sentences["Please wait"][ConfigurationMedicMod.Language].." "..math.Round(MedicMod.seconds-CurTime()).." "..ConfigurationMedicMod.Sentences["seconds to respawn."][ConfigurationMedicMod.Language], "MedicModFont17", w/2, h/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  87. elseif MedicMod.seconds == -1 then
  88. draw.SimpleText(ConfigurationMedicMod.Sentences["You're receiving CPR, you can't respawn."][ConfigurationMedicMod.Language], "MedicModFont17", w/2, h/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  89. else
  90. draw.SimpleText(ConfigurationMedicMod.Sentences["Click to respawn."][ConfigurationMedicMod.Language], "MedicModFont17", w/2, h/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  91. end
  92. end
  93. end
  94.  
  95. local nbStat = 1
  96.  
  97. if LocalPlayer():IsBleeding() then
  98. surface.SetDrawColor( 255, 255, 255, 255 )
  99. surface.SetMaterial( bleedingIcon )
  100. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  101.  
  102. draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Bleeding"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 255, 0, 0, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
  103. nbStat = nbStat + 1
  104. end
  105. if LocalPlayer():IsPoisoned() then
  106. surface.SetDrawColor( 255, 255, 255, 255 )
  107. surface.SetMaterial( poisonedIcon )
  108. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  109.  
  110. draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Poisoned"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 153, 201, 158, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
  111. nbStat = nbStat + 1
  112. end
  113. if LocalPlayer():GetHeartAttack() then
  114. surface.SetDrawColor( 255, 255, 255, 255 )
  115. surface.SetMaterial( hattackIcon )
  116. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  117.  
  118. draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Heart Attack"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat , Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
  119. nbStat = nbStat + 1
  120. end
  121. if LocalPlayer():IsMorphine() then
  122. surface.SetDrawColor( 255, 255, 255, 255 )
  123. surface.SetMaterial( morphIcon )
  124. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  125.  
  126. draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Morphine"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
  127. nbStat = nbStat + 1
  128. end
  129. if LocalPlayer():IsFractured() then
  130. surface.SetDrawColor( 255, 255, 255, 255 )
  131. surface.SetMaterial( breakIcon )
  132. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  133.  
  134. draw.SimpleTextOutlined( ConfigurationMedicMod.Sentences["Fracture"][ConfigurationMedicMod.Language], "MedicModFont30", ScrW() - 240, ScrH() - 140 - 50 * nbStat, Color( 255, 255, 255, 255 ), TEXT_ALIGN_LEFT, TEXT_ALIGN_TOP, 1, Color( 0, 0, 0, 255 ) )
  135. nbStat = nbStat + 1
  136. end
  137.  
  138. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement