Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. -- Grenade timers by Nyanpasu! (- Luiz)
  2.  
  3. local updatetick = 0;
  4. local grenades = {};
  5.  
  6. function EventHook(Event)
  7. -- Clean table on round start
  8. if Event:GetName() == "round_start" then
  9. grenades = {};
  10. end
  11. -- Remove expired grenades from Table
  12. if Event:GetName() == "hegrenade_detonate" or Event:GetName() == "flashbang_detonate"
  13. or Event:GetName() == "inferno_expire" or Event:GetName() == "inferno_extinguish" then
  14. updatetick = globals.TickCount();
  15. for index,value in pairs(grenades) do
  16. if value[1] == Event:GetInt("entityid") then
  17. table.remove(grenades, index);
  18. end
  19. end
  20. end
  21.  
  22. end
  23.  
  24. function ESPHook(Builder)
  25. -- Smoke Grenades
  26. if Builder:GetEntity():GetClass() == "CSmokeGrenadeProjectile"
  27. and Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin") ~= 0 then
  28. delta = (globals.TickCount() - Builder:GetEntity():GetProp("m_nSmokeEffectTickBegin")) * globals.TickInterval();
  29. Builder:AddBarBottom( 1 - (delta/17.5) )
  30. -- Flash and HE Grenades
  31. elseif Builder:GetEntity():GetClass() == "CBaseCSGrenadeProjectile" then
  32. local found = false;
  33. for index,value in pairs(grenades) do
  34. if value[1] == Builder:GetEntity():GetIndex() then
  35. DeltaT = (globals.TickCount() - grenades[index][2]) * globals.TickInterval();
  36. Builder:AddBarBottom( 1 - (DeltaT/1.65) )
  37. found = true;
  38. break;
  39. end
  40. end
  41. if found == false and globals.TickCount() > updatetick then
  42. local gMatrix = {Builder:GetEntity():GetIndex(), globals.TickCount()};
  43. table.insert(grenades, gMatrix);
  44. end
  45. end
  46.  
  47. end
  48.  
  49. function DrawingHook()
  50. for indexF,valueF in pairs(entities.FindByClass("CInferno")) do
  51. local found = false;
  52. for indexT,valueT in pairs(grenades) do
  53. if valueT[1] == valueF:GetIndex() then
  54. x, y = client.WorldToScreen( valueF:GetAbsOrigin() )
  55. local mollysize = 25;
  56. if x ~= nil and y ~= nil then
  57. draw.Color(0, 0, 0, 255);
  58. draw.RoundedRectFill( x - mollysize, y, x + mollysize, y + 4 );
  59. draw.Color(227, 227, 227, 255);
  60. local math = (((globals.TickCount() - valueT[2]) * ((-1) - 1))
  61. / ( (valueT[2] + 7 / globals.TickInterval()) - valueT[2])) + 1
  62. draw.RoundedRectFill( x - mollysize, y, x + mollysize * math, y + 4 )
  63. draw.Color(255, 255, 255, 255);
  64. draw.RoundedRect( x - mollysize, y, x + mollysize, y + 4)
  65. local w,h = draw.GetTextSize( "MOLLY" )
  66. draw.Text(x - w/2, y - h * 1.25 , "MOLLY");
  67. draw.TextShadow(x - w/2, y - h * 1.25 , "MOLLY");
  68. end
  69. found = true;
  70. break;
  71. end
  72. end
  73.  
  74. if found == false and globals.TickCount() > updatetick then
  75. local gMatrix = {valueF:GetIndex(), globals.TickCount()};
  76. table.insert(grenades, gMatrix);
  77. end
  78. end
  79. end
  80.  
  81. -- Grenade timers by Nyanpasu! (- Luiz)
  82.  
  83. client.AllowListener("round_start");
  84. client.AllowListener("inferno_expire");
  85. client.AllowListener("inferno_extinguish");
  86. client.AllowListener("molotov_detonate");
  87. client.AllowListener("hegrenade_detonate");
  88. client.AllowListener("flashbang_detonate");
  89.  
  90. callbacks.Register("FireGameEvent", "EventHookG", EventHook);
  91. callbacks.Register( "Draw", "DrawingHookG", DrawingHook );
  92. callbacks.Register( "DrawESP", "ESPHookG", ESPHook );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement