The_Belch

Fake Duck Indicator

Jul 21st, 2019
1,151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. local storedTick = 0
  2. local crouched_ticks = { }
  3.  
  4. local function toBits(num)
  5. local t = { }
  6. while num > 0 do
  7. rest = math.fmod(num,2)
  8. t[#t+1] = rest
  9. num = (num-rest) / 2
  10. end
  11.  
  12. return t
  13. end
  14.  
  15. callbacks.Register("DrawESP", "FD_Indicator", function(Builder)
  16. local g_Local = entities.GetLocalPlayer()
  17. local Entity = Builder:GetEntity()
  18.  
  19. if g_Local == nil or Entity == nil or not Entity:IsPlayer() or not Entity:IsAlive() then
  20. return
  21. end
  22.  
  23. local index = Entity:GetIndex()
  24. local m_flDuckAmount = Entity:GetProp("m_flDuckAmount")
  25. local m_flDuckSpeed = Entity:GetProp("m_flDuckSpeed")
  26. local m_fFlags = Entity:GetProp("m_fFlags")
  27.  
  28. if crouched_ticks[index] == nil then
  29. crouched_ticks[index] = 0
  30. end
  31.  
  32. if m_flDuckSpeed ~= nil and m_flDuckAmount ~= nil then
  33. if m_flDuckSpeed == 8 and m_flDuckAmount <= 0.9 and m_flDuckAmount > 0.01 and toBits(m_fFlags)[1] == 1 then
  34. if storedTick ~= globals.TickCount() then
  35. crouched_ticks[index] = crouched_ticks[index] + 1
  36. storedTick = globals.TickCount()
  37. end
  38.  
  39. if crouched_ticks[index] >= 5 then
  40. Builder:Color(255, 255, 0, 255)
  41. Builder:AddTextTop("Fake Duck")
  42. end
  43. else
  44. crouched_ticks[index] = 0
  45. end
  46. end
  47. end)
Add Comment
Please, Sign In to add comment