Advertisement
r4k0

Untitled

Aug 22nd, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.23 KB | None | 0 0
  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.  
  33.  
  34.  
  35. local deathPanel = nil
  36. local seconds = 0
  37.  
  38. net.Receive("MedicMod.Respawn", function(len,ply)
  39. seconds = net.ReadInt(32)
  40. end)
  41.  
  42. hook.Add("HUDPaint", "HUDPaint.MedicMod", function()
  43.  
  44. if ConfigurationMedicMod.MedicTeams and table.HasValue(ConfigurationMedicMod.MedicTeams, LocalPlayer():Team()) then
  45. for k, v in pairs(ents.FindByClass("prop_ragdoll")) do
  46.  
  47. if not v:IsDeathRagdoll() then continue end
  48.  
  49. local pos = ( v:GetPos() + Vector(0,0,10) ):ToScreen()
  50. local dist = v:GetPos():Distance(LocalPlayer():GetPos())
  51.  
  52. surface.SetDrawColor( 255, 255, 255, 255 )
  53. surface.SetMaterial( notifIcon )
  54. surface.DrawTexturedRect( pos.x - 25, pos.y, 50, 50 )
  55.  
  56. 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 ) )
  57.  
  58. end
  59. end
  60.  
  61. if not LocalPlayer():Alive() and not IsValid(deathPanel) then
  62. deathPanel = vgui.Create("DFrame")
  63. deathPanel:SetSize(ScrW()*0.25, ScrH()*0.125)
  64. deathPanel:SetTitle("")
  65. deathPanel:SetAlpha(0)
  66. deathPanel:AlphaTo(255,1.2)
  67. deathPanel:Center()
  68. deathPanel:ShowCloseButton(false)
  69. deathPanel.Paint = function(s,w,h)
  70. draw.RoundedBox(0, 0, 0, w, h, Color(102, 207, 255))
  71. draw.RoundedBox(0, 0, 0, w, h*0.20, Color(0, 157, 230))
  72. draw.SimpleText("Death Notice - Medic Mod", "MedicModFont17", w/2, h*0.20/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  73. draw.SimpleText("You have lost consciousness.","MedicModFont17",w/2,h/2-17.5,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  74. draw.SimpleText("You must be rescued by a medic, or wait." ,"MedicModFont17",w/2,h/2,Color(255,255,255),TEXT_ALIGN_CENTER,TEXT_ALIGN_CENTER)
  75. end
  76. deathPanel.Think = function(s)
  77. if LocalPlayer():Alive() then
  78. s:AlphaTo(0, 1.2, 0, function(data,pnl) pnl:Remove() end)
  79. end
  80. end
  81. local x,y = deathPanel:GetSize()
  82. local button1 = vgui.Create("DButton",deathPanel)
  83. button1:Dock(BOTTOM)
  84. button1:SetText("")
  85. button1:SetSize(0,y*0.25)
  86. button1.DoClick = function(s)
  87. if seconds-CurTime() > 0 then return end
  88. net.Start("MedicMod.Respawn")
  89. net.SendToServer()
  90. end
  91. button1.Paint = function(s,w,h)
  92. draw.RoundedBox(8, 0, 0, w, h, Color(0, 157, 230))
  93. if seconds-CurTime() > 0 then
  94. draw.SimpleText("Please wait "..math.Round(seconds-CurTime()).." seconds for respawn", "MedicModFont17", w/2, h/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  95. elseif seconds == -1 then
  96. draw.SimpleText("You're receiving CPR, you can't respawn", "MedicModFont17", w/2, h/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  97. else
  98. draw.SimpleText("Click to respawn", "MedicModFont17", w/2, h/2,Color( 255, 255, 255, 255 ), TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER)
  99. end
  100. end
  101. end
  102.  
  103. local nbStat = 1
  104.  
  105. if LocalPlayer():IsBleeding() then
  106. surface.SetDrawColor( 255, 255, 255, 255 )
  107. surface.SetMaterial( bleedingIcon )
  108. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  109.  
  110. 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 ) )
  111. nbStat = nbStat + 1
  112. end
  113. if LocalPlayer():IsPoisoned() then
  114. surface.SetDrawColor( 255, 255, 255, 255 )
  115. surface.SetMaterial( poisonedIcon )
  116. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  117.  
  118. 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 ) )
  119. nbStat = nbStat + 1
  120. end
  121. if LocalPlayer():GetHeartAttack() then
  122. surface.SetDrawColor( 255, 255, 255, 255 )
  123. surface.SetMaterial( hattackIcon )
  124. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  125.  
  126. 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 ) )
  127. nbStat = nbStat + 1
  128. end
  129. if LocalPlayer():IsMorphine() then
  130. surface.SetDrawColor( 255, 255, 255, 255 )
  131. surface.SetMaterial( morphIcon )
  132. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  133.  
  134. 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 ) )
  135. nbStat = nbStat + 1
  136. end
  137. if LocalPlayer():IsFractured() then
  138. surface.SetDrawColor( 255, 255, 255, 255 )
  139. surface.SetMaterial( breakIcon )
  140. surface.DrawTexturedRect( ScrW() - 300, ScrH() - 150 - 50 * nbStat, 50, 50 )
  141.  
  142. 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 ) )
  143. nbStat = nbStat + 1
  144. end
  145.  
  146. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement