Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. --[===[
  2.  
  3. Made by superyu'#7167
  4.  
  5. How it works:
  6. We will loop through the entity list and check for packet choking, desync is done by choking and thus a desyncing player will choke packets.
  7. If a player chokes packets the Simtime won't update, if we check if the simtime is equal to the last ticks simtime then the entity is choking packets.
  8. We will use this information to enable/disable the resolver.
  9.  
  10. Thanks to corrada for finding critical bug.
  11. --]===]
  12.  
  13. --- Gui Stuff
  14. local pos = gui.Reference("RAGE", "MAIN", "Extra")
  15. local enabled = gui.Checkbox(pos, "rbot_autoresolver", "Automatic Resolver", 0)
  16. local warningEnabled = gui.Checkbox(pos, "rbot_autoresolver_warning", "Desync Warning", 0)
  17. local listEnabled = gui.Checkbox(pos, "rbot_autoresolver_list", "Desync List", 0)
  18.  
  19. --- Tables.
  20. local isDesyncing = {};
  21. local lastSimtime = {};
  22. local desyncCooldown = {};
  23.  
  24. --- Variables
  25. local lastTick = 0;
  26. local pLocal = entities.GetLocalPlayer();
  27. local resolverTextCount = 0;
  28. local sampleTextWidth, sampleTextHeight
  29.  
  30. --- Hooks
  31. local function drawHook()
  32. pLocal = entities.GetLocalPlayer();
  33.  
  34. if listEnabled:GetValue() then
  35.  
  36. if engine.GetMapName() ~= "" then
  37. draw.Text(2, 400, gui.GetValue("rbot_resolver") and "Desyncing Players - Resolver: On" or "Desyncing Players - Resolver: Off")
  38. end
  39. sampleTextWidth, sampleTextHeight = draw.GetTextSize("Sample Text")
  40. end
  41.  
  42. if enabled:GetValue() then
  43. resolverTextCount = 0;
  44. for pEntityIndex, pEntity in pairs(entities.FindByClass("CCSPlayer")) do
  45. if pEntity:GetTeamNumber() ~= pLocal:GetTeamNumber() and pEntity:IsPlayer() and pEntity:IsAlive() then
  46. if globals.TickCount() > lastTick then
  47. if lastSimtime[pEntityIndex] ~= nil then
  48. if pEntity:GetProp("m_flSimulationTime") == lastSimtime[pEntityIndex] then
  49. isDesyncing[pEntityIndex] = true;
  50. desyncCooldown[pEntityIndex] = globals.TickCount();
  51. else
  52. if desyncCooldown[pEntityIndex] ~= nil then
  53. if desyncCooldown[pEntityIndex] < globals.TickCount() - 128 then
  54. isDesyncing[pEntityIndex] = false;
  55. end
  56. else
  57. isDesyncing[pEntityIndex] = false;
  58. end
  59. end
  60. end
  61. lastSimtime[pEntityIndex] = pEntity:GetProp("m_flSimulationTime")
  62. end
  63.  
  64. if engine.GetMapName() ~= "" then
  65. if isDesyncing[pEntityIndex] then
  66. if listEnabled:GetValue() then
  67. local pos = 410 + (sampleTextHeight * resolverTextCount)
  68. draw.Text(2, pos, pEntity:GetName())
  69. end
  70. resolverTextCount = resolverTextCount+1
  71. end
  72. end
  73. end
  74. end
  75. lastTick = globals.TickCount();
  76. if resolverTextCount ~= 0 then
  77. gui.SetValue("rbot_resolver", 1);
  78. else
  79. gui.SetValue("rbot_resolver", 0);
  80. end
  81. end
  82. end
  83.  
  84. local function aimbotTargetHook(pEntity)
  85. if enabled:GetValue() then
  86.  
  87. if not isDesyncing[pEntity:GetIndex()] then
  88. gui.SetValue("rbot_resolver", 0);
  89. else
  90. gui.SetValue("rbot_resolver", 1);
  91. end
  92. end
  93. end
  94.  
  95. local function drawEspHook(builder)
  96.  
  97. if warningEnabled:GetValue() then
  98. local pEntity = builder:GetEntity()
  99.  
  100. if pEntity:IsPlayer() and pEntity:IsAlive() and pEntity:GetTeamNumber() ~= pLocal:GetTeamNumber() then
  101.  
  102. if isDesyncing[pEntity:GetIndex()] then
  103. builder:Color(255, 25, 25, 255)
  104. builder:AddTextBottom("Desync")
  105. else
  106. builder:Color(255, 255, 25, 255)
  107. builder:AddTextBottom("No Desync")
  108. end
  109. end
  110. end
  111. end
  112.  
  113. --- Callbacks
  114. callbacks.Register("Draw", drawHook)
  115. callbacks.Register("AimbotTarget", aimbotTargetHook)
  116. callbacks.Register("DrawESP", drawEspHook)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement