Advertisement
Guest User

Untitled

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