Advertisement
Guest User

bettersync

a guest
Feb 28th, 2020
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.03 KB | None | 0 0
  1. ---
  2. --- Title: BetterSync™
  3. --- Author: superyu'#7167, special thanks to april#0001, gowork88#1556 and Shady#0001
  4. --- Description: BetterSync is a lua Extention for Aimware, it's purpose is to add more configuration to the Anti-Aimbot, it heavily focuses on the desync part.
  5. ---
  6.  
  7. --- Auto updater Variables
  8. local SCRIPT_FILE_NAME = GetScriptName();
  9. local SCRIPT_FILE_ADDR = "https://raw.githubusercontent.com/superyor/BetterSync/master/BetterSync.lua";
  10. local VERSION_FILE_ADDR = "https://raw.githubusercontent.com/superyor/BetterSync/master/version.txt"; --- in case of update i need to update this. (Note by superyu'#7167 "so i don't forget it.")#
  11. local VERSION_NUMBER = "3.4"; --- This too
  12. local version_check_done = false;
  13. local update_downloaded = false;
  14. local update_available = false;
  15.  
  16. --- Auto Updater GUI Stuff
  17. local BETTERSYNC_UPDATER_TAB = gui.Tab(gui.Reference("Settings"), "bettersync.updater.tab", "BetterSync™ Autoupdater")
  18. local BETTERSYNC_UPDATER_GROUP = gui.Groupbox(BETTERSYNC_UPDATER_TAB, "Auto Updater for BetterSync™ | v" .. VERSION_NUMBER, 15, 15, 600, 600)
  19. local BETTERSYNC_UPDATER_TEXT = gui.Text(BETTERSYNC_UPDATER_GROUP, "")
  20.  
  21. --- BetterSync Tab
  22. local BETTERSYNC_TAB = gui.Tab(gui.Reference("Ragebot"), "bettersync.tab", "BetterSync")
  23. local BETTERSYNC_DESYNC_GROUP = gui.Groupbox(gui.Reference("Ragebot", "BetterSync"), "Desync", 15, 15, 240, 325);
  24. local BETTERSYNC_MISC_GROUP = gui.Groupbox(gui.Reference("Ragebot", "BetterSync"), "Misc", 15, 30+(325/2)+15+58, 240, 100)
  25. local BETTERSYNC_SWAY_ROTATION_GROUP = gui.Groupbox(gui.Reference("Ragebot", "BetterSync"), "Rotation Sway", 255+15, 15, 350, 500);
  26. local BETTERSYNC_SWAY_LBY_GROUP = gui.Groupbox(gui.Reference("Ragebot", "BetterSync"), "LBY Sway", 255+15, 15+250, 350, 500);
  27.  
  28. --- Desync GUI Stuff
  29. local BETTERSYNC_ENABLE = gui.Checkbox(BETTERSYNC_DESYNC_GROUP, "rbot.bettersync.enabled", "Enabled", false)
  30. local BETTERSYNC_LBY_MODE = gui.Combobox(BETTERSYNC_DESYNC_GROUP, "rbot.bettersync.lby.mode", "LBY Mode", "Off", "Match", "Invert", "180", "Sway")
  31. local BETTERSYNC_LBY_FACTOR = gui.Slider(BETTERSYNC_DESYNC_GROUP, "rbot.bettersync.lby.factor", "LBY Factor", 1, 1, 3)
  32. local BETTERSYNC_LBY_FACTOR_TEXT = gui.Text(BETTERSYNC_DESYNC_GROUP, "")
  33. local BETTERSYNC_ANTILBY = gui.Checkbox(BETTERSYNC_DESYNC_GROUP, "rbot.bettersync.antilby", "Anti-LBY", 0);
  34.  
  35. --- Misc GUI Stuff
  36. local BETTERSYNC_JUMPSCOUT = gui.Checkbox(BETTERSYNC_MISC_GROUP, "rbot.bettersync.misc.jumpscout", "Fix Jumpscout", 0)
  37. local BETTERSYNC_PULSEFAKE = gui.Checkbox(BETTERSYNC_MISC_GROUP, "rbot.bettersync.misc.pulsefake", "Pulsating Fake Chams", 0);
  38. local BETTERSYNC_CREDITS = gui.Text(BETTERSYNC_MISC_GROUP, "Made witth love by superyu'#7167.")
  39. local BETTERSYNC_CREDITS2 = gui.Text(BETTERSYNC_MISC_GROUP, "Thanks to everyone that supports me!")
  40. local BETTERSYNC_CREDITS3 = gui.Text(BETTERSYNC_MISC_GROUP, "Shoutouts to Shady and Cheeseot!")
  41.  
  42. ---Sway GUI Stuff
  43. local BETTERSYNC_SWAY_ROTATION_SPEED = gui.Slider(BETTERSYNC_SWAY_ROTATION_GROUP, "rbot.bettersync.sway.rotation.speed", "Speed", 3, 1, 15);
  44. local BETTERSYNC_SWAY_ROTATION_RANGE1 = gui.Slider(BETTERSYNC_SWAY_ROTATION_GROUP, "rbot.bettersync.sway.rotation.rangestart", "Range Start", -58, -58, 58);
  45. local BETTERSYNC_SWAY_ROTATION_RANGE2 = gui.Slider(BETTERSYNC_SWAY_ROTATION_GROUP, "rbot.bettersync.sway.rotation.rangeend", "Range End", 58, -58, 58);
  46. local BETTERSYNC_SWAY_ROTATION_DEADZONE = gui.Slider(BETTERSYNC_SWAY_ROTATION_GROUP, "rbot.bettersync.sway.rotation.deadzone", "Deadzone", 30, 0, 58);
  47.  
  48. ---Sway GUI Stuff
  49. local BETTERSYNC_SWAY_LBY_SPEED = gui.Slider(BETTERSYNC_SWAY_LBY_GROUP, "rbot.bettersync.sway.lby.speed", "Speed", 3, 1, 15);
  50. local BETTERSYNC_SWAY_LBY_RANGE1 = gui.Slider(BETTERSYNC_SWAY_LBY_GROUP, "rbot.bettersync.sway.lby.rangestart", "Range Start", -180, -180, 180);
  51. local BETTERSYNC_SWAY_LBY_RANGE2 = gui.Slider(BETTERSYNC_SWAY_LBY_GROUP, "rbot.bettersync.sway.lby.rangeend", "Range End", 180, -180, 180);
  52. local BETTERSYNC_SWAY_LBY_DEADZONE = gui.Slider(BETTERSYNC_SWAY_LBY_GROUP, "rbot.bettersync.sway.lby.deadzone", "Deadzone", 90, 0, 180);
  53.  
  54. --- BetterSync Variables
  55. local pLocal;
  56. local max, min = 0, 0;
  57. local cs, cd = 0, 0;
  58. local cs2, cd2, s = 0, 0, 2;
  59. local max3, min3 = 0, 0;
  60. local cs3, cd3 = 0, 0;
  61. local del = globals.CurTime() + 0.100
  62. local inFreezeTime = false;
  63. local switch = false;
  64. local dx, dy, rx, ry = 0, 0, 0, 0
  65. local lastTick = 0;
  66. local lastTickPulse = 0
  67.  
  68. --- Listeners
  69. client.AllowListener("round_freeze_end")
  70. client.AllowListener("round_start")
  71. --- Helpers
  72. local function round(num, numDecimalPlaces)
  73. return tonumber(string.format("%." .. (numDecimalPlaces or 0) .. "f", num))
  74. end
  75.  
  76. local function handlePulse()
  77.  
  78. if (BETTERSYNC_PULSEFAKE:GetValue()) then
  79.  
  80. if globals.TickCount() > lastTickPulse then
  81.  
  82. if (cs2 >= 125) then
  83. cd2 = 1;
  84. elseif (cs2 <= 0 + s) then
  85. cd2 = 0;
  86. end
  87.  
  88. if (cd2 == 0) then
  89. cs2 = cs2 + s;
  90. elseif (cd2 == 1) then
  91. cs2 = cs2 - s;
  92. end
  93.  
  94. if cs2 < 0 then cs2 = 0 end
  95. local r, g, b, a = gui.GetValue("esp.chams.ghost.visible.clr");
  96. gui.SetValue("esp.chams.ghost.visible.clr", r, g, b, cs2);
  97. lastTickPulse = globals.TickCount()
  98. end
  99. end
  100. end
  101.  
  102. local function handleDesync()
  103.  
  104. local val = gui.GetValue("rbot.antiaim.base.rotation");
  105.  
  106. if globals.TickCount() > lastTick then
  107.  
  108. if BETTERSYNC_ENABLE:GetValue() then
  109. local speed = BETTERSYNC_SWAY_ROTATION_SPEED:GetValue() / 3
  110.  
  111. if BETTERSYNC_SWAY_ROTATION_RANGE1:GetValue() < BETTERSYNC_SWAY_ROTATION_RANGE2:GetValue() then
  112. min = BETTERSYNC_SWAY_ROTATION_RANGE1:GetValue()
  113. max = BETTERSYNC_SWAY_ROTATION_RANGE2:GetValue()
  114. else
  115. min = BETTERSYNC_SWAY_ROTATION_RANGE2:GetValue()
  116. max = BETTERSYNC_SWAY_ROTATION_RANGE1:GetValue()
  117. end
  118.  
  119. if (cs >= max) then
  120. cd = 1;
  121. elseif (cs <= min + speed) then
  122. cd = 0;
  123. end
  124.  
  125. if (cd == 0) then
  126. cs = cs + speed;
  127. elseif (cd == 1) then
  128. cs = cs - speed;
  129. end
  130.  
  131. local deadzoneP = BETTERSYNC_SWAY_ROTATION_DEADZONE:GetValue()
  132. local deadzoneN = deadzoneP * -1
  133.  
  134. if cs > 0 then
  135. if cs < deadzoneP then
  136. cs = deadzoneN
  137. end
  138. end
  139.  
  140. if cs < 0 then
  141. if cs > deadzoneN then
  142. cs = deadzoneP
  143. end
  144. end
  145. val = cs;
  146. end
  147.  
  148.  
  149. if BETTERSYNC_LBY_MODE:GetValue() == 4 then
  150. local speed2 = BETTERSYNC_SWAY_LBY_SPEED:GetValue() / 3
  151.  
  152. if BETTERSYNC_SWAY_LBY_RANGE1:GetValue() < BETTERSYNC_SWAY_LBY_RANGE2:GetValue() then
  153. min3 = BETTERSYNC_SWAY_LBY_RANGE1:GetValue()
  154. max3 = BETTERSYNC_SWAY_LBY_RANGE2:GetValue()
  155. else
  156. min3 = BETTERSYNC_SWAY_LBY_RANGE2:GetValue()
  157. max3 = BETTERSYNC_SWAY_LBY_RANGE1:GetValue()
  158. end
  159.  
  160. if (cs3 >= max3) then
  161. cd3 = 1;
  162. elseif (cs3 <= min3 + speed2) then
  163. cd3 = 0;
  164. end
  165.  
  166. if (cd3 == 0) then
  167. cs3 = cs3 + speed2;
  168. elseif (cd3 == 1) then
  169. cs3 = cs3 - speed2;
  170. end
  171.  
  172. local deadzoneP = BETTERSYNC_SWAY_LBY_DEADZONE:GetValue()
  173. local deadzoneN = deadzoneP * -1
  174.  
  175. if cs3 > 0 then
  176. if cs3 < deadzoneP then
  177. cs3 = deadzoneN
  178. end
  179. end
  180.  
  181. if cs3 < 0 then
  182. if cs3 > deadzoneN then
  183. cs3 = deadzoneP
  184. end
  185. end
  186.  
  187. gui.SetValue("rbot.antiaim.base.lby", cs3)
  188. gui.SetValue("rbot.antiaim.left.lby", cs3)
  189. gui.SetValue("rbot.antiaim.right.lby", cs3)
  190. end
  191.  
  192. local lby = 0
  193.  
  194. if BETTERSYNC_LBY_MODE:GetValue() > 0 and BETTERSYNC_LBY_MODE:GetValue() ~= 4 then
  195.  
  196. if BETTERSYNC_LBY_MODE:GetValue() == 1 then
  197.  
  198. if BETTERSYNC_LBY_FACTOR:GetValue() == 1 then
  199. lby = val;
  200. elseif BETTERSYNC_LBY_FACTOR:GetValue() == 2 then
  201. if val > 0 then
  202. lby = 58;
  203. else
  204. lby = -58
  205. end
  206. else
  207. if val > 0 then
  208. lby = 120;
  209. else
  210. lby = -120;
  211. end
  212. end
  213.  
  214. elseif BETTERSYNC_LBY_MODE:GetValue() == 2 then
  215.  
  216. if BETTERSYNC_LBY_FACTOR:GetValue() == 1 then
  217. lby = val * -1;
  218. elseif BETTERSYNC_LBY_FACTOR:GetValue() == 2 then
  219. if val > 0 then
  220. lby = -58;
  221. else
  222. lby = 58
  223. end
  224. else
  225. if val > 0 then
  226. lby = -120;
  227. else
  228. lby = 120;
  229. end
  230. end
  231.  
  232. else
  233. lby = 180
  234. end
  235.  
  236. gui.SetValue("rbot.antiaim.base.lby", lby)
  237. gui.SetValue("rbot.antiaim.left.lby", lby)
  238. gui.SetValue("rbot.antiaim.right.lby", lby)
  239. end
  240.  
  241. if not inFreezeTime and BETTERSYNC_ENABLE:GetValue() then
  242. gui.SetValue("rbot.antiaim.base.rotation", val)
  243. gui.SetValue("rbot.antiaim.left.rotation", val)
  244. gui.SetValue("rbot.antiaim.right.rotation", val)
  245. end
  246.  
  247. lastTick = globals.TickCount()
  248. end
  249. end
  250.  
  251. local function handleVelocity()
  252.  
  253. if not pLocal then
  254. return
  255. end
  256.  
  257. local vel = math.sqrt(pLocal:GetPropFloat( "localdata", "m_vecVelocity[0]" )^2 + pLocal:GetPropFloat( "localdata", "m_vecVelocity[1]" )^2)
  258.  
  259. if BETTERSYNC_JUMPSCOUT:GetValue() then
  260. if vel > 5 then
  261. gui.SetValue("misc.strafe.enable", 1)
  262. else
  263. gui.SetValue("misc.strafe.enable", 0)
  264. end
  265. end
  266.  
  267. if del < globals.CurTime() then
  268. switch = not switch
  269. del = globals.CurTime() + 0.050
  270. end
  271.  
  272. if vel > 3 then
  273. del = globals.CurTime() + 0.050
  274. end
  275.  
  276. end
  277.  
  278. local function handleText()
  279. if BETTERSYNC_LBY_FACTOR:GetValue() == 1 then
  280. BETTERSYNC_LBY_FACTOR_TEXT:SetText("Current Factor: Default")
  281. elseif BETTERSYNC_LBY_FACTOR:GetValue() == 2 then
  282. BETTERSYNC_LBY_FACTOR_TEXT:SetText("Current Factor: Strong")
  283. else BETTERSYNC_LBY_FACTOR:GetValue()
  284. BETTERSYNC_LBY_FACTOR_TEXT:SetText("Current Factor: Stronger")
  285. end
  286. end
  287.  
  288. --- Hooks
  289. local function drawHook()
  290. pLocal = entities.GetLocalPlayer()
  291.  
  292. handleText()
  293. handlePulse()
  294. handleVelocity()
  295. handleDesync()
  296.  
  297. if engine.GetMapName() == "" then
  298. lastTickPulse = 0;
  299. lastTick = 0;
  300. end
  301. end
  302.  
  303. local function CreateMoveHook(pCmd)
  304.  
  305. if not pLocal then
  306. return
  307. end
  308.  
  309. local vel = math.sqrt(pLocal:GetPropFloat( "localdata", "m_vecVelocity[0]" )^2 + pLocal:GetPropFloat( "localdata", "m_vecVelocity[1]" )^2)
  310.  
  311. if vel > 3 then
  312. return
  313. end
  314.  
  315. if BETTERSYNC_ANTILBY:GetValue() then
  316. if switch then
  317. pCmd.sidemove = 2
  318. else
  319. pCmd.sidemove = -2
  320. end
  321. end
  322. end
  323.  
  324. local function EventHook(event)
  325.  
  326. if event:GetName() == "round_freeze_end" then
  327. inFreezeTime = false;
  328. end
  329.  
  330. if event:GetName() == "round_start" then
  331. inFreezeTime = true;
  332. end
  333. end
  334.  
  335. --- Callbacks
  336. callbacks.Register( "Draw", drawHook);
  337. callbacks.Register( "CreateMove", CreateMoveHook)
  338. callbacks.Register("FireGameEvent", EventHook)
  339.  
  340. --- Auto updater by ShadyRetard/Shady#0001
  341. local function handleUpdates()
  342.  
  343. if (update_available and not update_downloaded) then
  344. BETTERSYNC_UPDATER_TEXT:SetText("Update is getting downloaded.")
  345. local new_version_content = http.Get(SCRIPT_FILE_ADDR);
  346. local old_script = file.Open(SCRIPT_FILE_NAME, "w");
  347. old_script:Write(new_version_content);
  348. old_script:Close();
  349. update_available = false;
  350. update_downloaded = true;
  351. end
  352.  
  353. if (update_downloaded) then
  354. BETTERSYNC_UPDATER_TEXT:SetText("Update available, please reload the script.")
  355. return;
  356. end
  357.  
  358. if (not version_check_done) then
  359. version_check_done = true;
  360. local version = http.Get(VERSION_FILE_ADDR);
  361. if (version ~= VERSION_NUMBER) then
  362. update_available = true;
  363. end
  364. BETTERSYNC_UPDATER_TEXT:SetText("Your client is up to date. Current Version: v" .. VERSION_NUMBER)
  365. end
  366. end
  367.  
  368. callbacks.Register("Draw", handleUpdates)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement