Advertisement
Guest User

Desyncaa

a guest
Mar 21st, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.51 KB | None | 0 0
  1. ----------------------------------------
  2. ----------- Update log -----------
  3. ----------------------------------------
  4. -- Update (20 Mar, 2019)
  5. -- Improved "Static" and "Jitter" anti-aim modes
  6. -- Improved freestanding for "No fake" anti-aim mode
  7.  
  8. -- Update (19 Mar, 2019)
  9. -- Freestanding is now a separate option and works with all anti-aim modes (still requires Vector3.lua)
  10. -- Now using one key to switch sides instead of two (put hotkey style to "Toggle" to make manual anti-aim work properly)
  11. -- Implemented "Static body yaw" to work with "Static" and "Jitter" anti-aim modes (all credits go to abbie)
  12. -- Code improvements
  13.  
  14. -- Update (16 Mar, 2019)
  15. -- Removed "Experimental" anti-aim style
  16. -- Added "No fake" anti-aim style
  17. -- Added "Freestanding" anti-aim style, based on "Static" anti-aim style (requires Vector3.lua - all credits go to Horse)
  18.  
  19. -- Update (13 Mar, 2019)
  20. -- Changed behavior of "Experimental" anti-aim style (now works similar to Jitter)
  21. -- Changed combobox to multiselect for indicators (they now show your fake for both anti-aim styles)
  22.  
  23. -- Recode (04 Mar, 2019)
  24. -- Added "Experimental" anti-aim style (most useful with scout)
  25. -- Removed two features: "On shot anti-aim fix", "Reposition indicators"
  26. -- Now using two different hotkeys to change sides of the anti-aim (if you want to use one key for both sides, set the first hotkey type to "On hotkey" and the second one to "Toggle")
  27. -- Indicators for "Static" anti-aim style show your fake angle; indicators for "Experimental" anti-aim style show your real angle
  28.  
  29. -- Update (01 Mar, 2019)
  30. -- No longer using edge yaw in anti-aim list
  31. -- You are able to use "fake duck" by default, but enabling "on shot anti-aim" and "on shot fix" will cause automatic deactivation of this feature
  32.  
  33. -- Credits: Horse, abbie, italian, duk
  34. ----------------------------------------
  35. ----------------------------------------
  36. ----------------------------------------
  37.  
  38. require "Vector3"
  39.  
  40. -- Local variables
  41. local client, ui, client_set_event_callback, client_get_cvar, client_draw_indicator, client_draw_text, client_screensize = client, ui, client.set_event_callback, client.get_cvar, client.draw_indicator, client.draw_text, client.screen_size
  42. local ui_get, ui_set, ui_set_visible, ui_ref = ui.get, ui.set, ui.set_visible, ui.reference
  43. local entity_get_local_player, entity_get_prop, entity_is_alive = entity.get_local_player, entity.get_prop, entity.is_alive
  44. enemyclosesttocrosshair = nil
  45. lowestfov = math.huge
  46. lowestdmg = math.huge
  47.  
  48. -- Anti-aim references
  49. local pitch = ui_ref("AA", "Anti-aimbot angles", "Pitch")
  50. local base = ui_ref("AA", "Anti-aimbot angles", "Yaw base")
  51. local yaw, yaw_slider = ui_ref("AA", "Anti-aimbot angles", "Yaw")
  52. local yawjitter, yawjitter_slider = ui_ref("AA", "Anti-aimbot angles", "Yaw jitter")
  53. local bodyyaw, bodyyaw_slider = ui_ref("AA", "Anti-aimbot angles", "Body yaw")
  54. local limit = ui_ref("AA", "Anti-aimbot angles", "Fake yaw limit")
  55. local edgeyaw = ui_ref("AA", "Anti-aimbot angles", "Edge yaw")
  56. local freestanding = ui_ref("AA", "Anti-aimbot angles", "Freestanding")
  57. local twist = ui_ref("AA", "Anti-aimbot angles", "Twist")
  58. local lby = ui_ref("AA", "Anti-aimbot angles", "Lower body yaw")
  59.  
  60. -- New UI elements
  61. local desync = ui.new_checkbox("AA", "Other", "Desync anti-aim")
  62. local color = ui.new_color_picker("AA", "Other", "Arrow color", 124, 195, 13, 220)
  63. local desyncstyle = ui.new_combobox("AA", "Other", "Desync mode", "Off", "Static", "Jitter", "No fake")
  64. local desynckey = ui.new_hotkey("AA", "Other", "Switch key")
  65. local indmulti = ui.new_multiselect("AA", "Other", "Anti-aim angle indicator", "Text", "Arrows")
  66. local autod = ui.new_checkbox("AA", "Other", "Freestanding")
  67. ui_set_visible(desynckey, false)
  68. ui_set_visible(indmulti, false)
  69. ui_set(yaw, "180")
  70. -- End of local variables
  71.  
  72. -----------------------------------
  73. ---- Freestanding calculations ----
  74. -----------------------------------
  75. function Angle_Vector(angle_x, angle_y)
  76. sp, sy, cp, cy = nil
  77. sy = math.sin(math.rad(angle_y));
  78. cy = math.cos(math.rad(angle_y));
  79. sp = math.sin(math.rad(angle_x));
  80. cp = math.cos(math.rad(angle_x));
  81. return cp * cy, cp * sy, -sp;
  82. end
  83.  
  84. function EnemyToCrosshair(index)
  85. fov = get_FOV(Vector3(client.camera_angles()), Vector3(client.eye_position()), Vector3(entity.hitbox_position(index, 0)))
  86. if(fov < lowestfov) then
  87. lowestfov = fov
  88. enemyclosesttocrosshair = index
  89. end
  90. end
  91.  
  92. function CalcAngle(localplayerxpos, localplayerypos, enemyxpos, enemyypos)
  93. relativeyaw = math.atan( (localplayerypos - enemyypos) / (localplayerxpos - enemyxpos) )
  94. return relativeyaw * 180 / math.pi
  95. end
  96.  
  97. function calculateBestAngle(enemy, ...)
  98. lx, ly, lz = entity_get_prop(entity_get_local_player(), "m_vecOrigin")
  99. viewangle_x, viewangle_y, roll = client.camera_angles()
  100. headx, heady, headz = entity.hitbox_position(entity_get_local_player(), 0)
  101. enemyx, enemyy, enemyz = entity_get_prop(enemy, "m_vecOrigin")
  102. mypos = Vector3(client.eye_position())
  103. bestangle = nil
  104.  
  105. if(entity.is_alive(enemy)) then
  106. yaw = CalcAngle(lx, ly, enemyx, enemyy)
  107. for i,v in pairs({...}) do
  108.  
  109. dir_x, dir_y, dir_z = Angle_Vector(0, (yaw + v))
  110. end_x = lx + dir_x * 55
  111. end_y = ly + dir_y * 55
  112. end_z = lz + 80
  113.  
  114. index, damage = client.trace_bullet(enemy, enemyx, enemyy, enemyz + 70, end_x, end_y, end_z)
  115.  
  116. index2, damage2 = client.trace_bullet(enemy, enemyx, enemyy, enemyz + 70, end_x + 12, end_y, end_z)
  117.  
  118. index3, damage3 = client.trace_bullet(enemy, enemyx, enemyy, enemyz + 70, end_x - 12, end_y, end_z)
  119.  
  120. if(damage < lowestdmg) then
  121. lowestdmg = damage
  122. if(damage2 > damage) then
  123. lowestdmg = damage2
  124. end
  125. if(damage3 > damage) then
  126. lowestdamage = damage3
  127. end
  128. if(lx - enemyx > 0) then
  129. bestangle = v
  130. else
  131. bestangle = v * -1
  132. end
  133. else if(damage == lowestdmg) then
  134. return 0
  135. end
  136. end
  137. end
  138. end
  139.  
  140. return bestangle
  141. end
  142. -----------------------------------
  143. -----------------------------------
  144.  
  145. -- UI elements on "Static" or "No fake" or "Jitter"
  146. local function combo()
  147. local enabled = ui_get(desync) and ui_get(desyncstyle) == "Static" or ui_get(desync) and ui_get(desyncstyle) == "No fake" or ui_get(desync) and ui_get(desyncstyle) == "Jitter"
  148. ui_set_visible(desynckey, enabled)
  149. ui_set_visible(indmulti, enabled)
  150. ui_set_visible(color, enabled)
  151. if ui_get(desyncstyle) == "Off" then
  152. ui_set(indmulti, "-")
  153. end
  154. end
  155. ui.set_callback(desyncstyle, combo)
  156.  
  157. -- Multiselect table
  158. local function contains(table, val)
  159. for i=1, #table do
  160. if table[i] == val then
  161. return true
  162. end
  163. end
  164. return false
  165. end
  166.  
  167. -- Manual anti-aims
  168. client_set_event_callback("paint", function()
  169. if not ui_get(desync) or ui_get(desyncstyle) == "Off" or entity_get_local_player() == nil or not entity_is_alive(entity_get_local_player()) then
  170. return
  171. end
  172.  
  173. local value = ui_get(indmulti)
  174. if #value == 0 then
  175. return
  176. end
  177.  
  178. local scrsize_x, scrsize_y = client_screensize()
  179. local center_x, center_y = scrsize_x / 2, scrsize_y / 2
  180. local ind_r, ind_g, ind_b, ind_a = ui_get(color)
  181.  
  182. if ui_get(desyncstyle) == "Static" then
  183. if ui_get(desynckey) then
  184. ui_set(pitch, "Minimal")
  185. ui_set(base, "Local view")
  186. ui_set(yaw_slider, "-30")
  187. ui_set(yawjitter, "Offset")
  188. ui_set(yawjitter_slider, "0")
  189. ui_set(bodyyaw, "Static")
  190. ui_set(bodyyaw_slider, "-180")
  191. ui_set(limit, "60")
  192. ui_set(edgeyaw, "Off")
  193. ui_set(freestanding, "-")
  194. ui_set(twist, true)
  195. ui_set(lby, false)
  196. if contains(value, "Text") then
  197. client_draw_indicator(ctx, 124, 195, 13, 237, "LEFT")
  198. end
  199. if contains(value, "Arrows") then
  200. client_draw_text(c, center_x - 40, center_y, ind_r, ind_g, ind_b, ind_a, "c+", 0, "◄")
  201. client_draw_text(c, center_x + 40, center_y, 255, 255, 255, 220, "c+", 0, "►")
  202. end
  203. else
  204. ui_set(pitch, "Minimal")
  205. ui_set(base, "Local view")
  206. ui_set(yaw_slider, "8")
  207. ui_set(yawjitter, "Offset")
  208. ui_set(yawjitter_slider, "0")
  209. ui_set(bodyyaw, "Static")
  210. ui_set(bodyyaw_slider, "180")
  211. ui_set(limit, "60")
  212. ui_set(edgeyaw, "Off")
  213. ui_set(freestanding, "-")
  214. ui_set(twist, true)
  215. ui_set(lby, false)
  216. if contains(value, "Text") then
  217. client_draw_indicator(ctx, 124, 195, 13, 237, "RIGHT")
  218. end
  219. if contains(value, "Arrows") then
  220. client_draw_text(c, center_x + 40, center_y, ind_r, ind_g, ind_b, ind_a, "c+", 0, "►")
  221. client_draw_text(c, center_x - 40, center_y, 255, 255, 255, 220, "c+", 0, "◄")
  222. end
  223. end
  224. end
  225. if ui_get(desyncstyle) == "Jitter" then
  226. if ui_get(desynckey) then
  227. ui_set(pitch, "Minimal")
  228. ui_set(base, "Local view")
  229. ui_set(yaw_slider, "-33")
  230. ui_set(yawjitter, "Center")
  231. ui_set(yawjitter_slider, "3")
  232. ui_set(bodyyaw, "Static")
  233. ui_set(bodyyaw_slider, "-180")
  234. ui_set(limit, "60")
  235. ui_set(edgeyaw, "Off")
  236. ui_set(freestanding, "-")
  237. ui_set(twist, true)
  238. ui_set(lby, false)
  239. if contains(value, "Text") then
  240. client_draw_indicator(ctx, 124, 195, 13, 237, "LEFT")
  241. end
  242. if contains(value, "Arrows") then
  243. client_draw_text(c, center_x - 40, center_y, ind_r, ind_g, ind_b, ind_a, "c+", 0, "◄")
  244. client_draw_text(c, center_x + 40, center_y, 255, 255, 255, 220, "c+", 0, "►")
  245. end
  246. else
  247. ui_set(pitch, "Minimal")
  248. ui_set(base, "Local view")
  249. ui_set(yaw_slider, "8")
  250. ui_set(yawjitter, "Center")
  251. ui_set(yawjitter_slider, "-3")
  252. ui_set(bodyyaw, "Static")
  253. ui_set(bodyyaw_slider, "180")
  254. ui_set(limit, "60")
  255. ui_set(edgeyaw, "Off")
  256. ui_set(freestanding, "-")
  257. ui_set(twist, true)
  258. ui_set(lby, false)
  259. if contains(value, "Text") then
  260. client_draw_indicator(ctx, 124, 195, 13, 237, "RIGHT")
  261. end
  262. if contains(value, "Arrows") then
  263. client_draw_text(c, center_x + 40, center_y, ind_r, ind_g, ind_b, ind_a, "c+", 0, "►")
  264. client_draw_text(c, center_x - 40, center_y, 255, 255, 255, 220, "c+", 0, "◄")
  265. end
  266. end
  267. end
  268. if ui_get(desyncstyle) == "No fake" then
  269. if ui_get(desynckey) then
  270. ui_set(pitch, "Minimal")
  271. ui_set(base, "Local view")
  272. ui_set(yaw_slider, "-90")
  273. ui_set(yawjitter, "Off")
  274. ui_set(bodyyaw, "Off")
  275. ui_set(edgeyaw, "Off")
  276. ui_set(freestanding, "-")
  277. ui_set(twist, false)
  278. ui_set(lby, false)
  279. if contains(value, "Text") then
  280. client_draw_indicator(ctx, 124, 195, 13, 237, "LEFT")
  281. end
  282. if contains(value, "Arrows") then
  283. client_draw_text(c, center_x - 40, center_y, ind_r, ind_g, ind_b, ind_a, "c+", 0, "◄")
  284. client_draw_text(c, center_x + 40, center_y, 255, 255, 255, 220, "c+", 0, "►")
  285. end
  286. else
  287. ui_set(pitch, "Minimal")
  288. ui_set(base, "Local view")
  289. ui_set(yaw_slider, "90")
  290. ui_set(yawjitter, "Off")
  291. ui_set(bodyyaw, "Off")
  292. ui_set(edgeyaw, "Off")
  293. ui_set(freestanding, "-")
  294. ui_set(twist, false)
  295. ui_set(lby, false)
  296. if contains(value, "Text") then
  297. client_draw_indicator(ctx, 124, 195, 13, 237, "RIGHT")
  298. end
  299. if contains(value, "Arrows") then
  300. client_draw_text(c, center_x + 40, center_y, ind_r, ind_g, ind_b, ind_a, "c+", 0, "►")
  301. client_draw_text(c, center_x - 40, center_y, 255, 255, 255, 220, "c+", 0, "◄")
  302. end
  303. end
  304. end
  305. end)
  306.  
  307. -- Freestanding anti-aims
  308. client_set_event_callback("run_command", function()
  309. if not ui_get(desync) or ui_get(desyncstyle) == "Off" or entity_get_local_player() == nil or not entity_is_alive(entity_get_local_player()) then
  310. return
  311. end
  312.  
  313. for i,v in pairs(entity.get_players(true)) do
  314. EnemyToCrosshair(v)
  315. end
  316.  
  317. if ui_get(autod) then
  318. ui_set(indmulti, "-")
  319. ui_set_visible(desynckey, false)
  320. ui_set_visible(indmulti, false)
  321. ui_set_visible(color, false)
  322. if ui_get(desyncstyle) == "Static" then
  323. if (enemyclosesttocrosshair ~= nil) then
  324. yaw = calculateBestAngle(enemyclosesttocrosshair, -90, 90)
  325. if (yaw == -90) then
  326. ui_set(pitch, "Minimal")
  327. ui_set(base, "Local view")
  328. ui_set(yaw_slider, "8")
  329. ui_set(yawjitter, "Offset")
  330. ui_set(yawjitter_slider, "0")
  331. ui_set(bodyyaw, "Static")
  332. ui_set(bodyyaw_slider, "180")
  333. ui_set(limit, "60")
  334. ui_set(edgeyaw, "Off")
  335. ui_set(freestanding, "-")
  336. ui_set(twist, true)
  337. ui_set(lby, false)
  338. else if (yaw == 90) then
  339. ui_set(pitch, "Minimal")
  340. ui_set(base, "Local view")
  341. ui_set(yaw_slider, "-30")
  342. ui_set(yawjitter, "Offset")
  343. ui_set(yawjitter_slider, "0")
  344. ui_set(bodyyaw, "Static")
  345. ui_set(bodyyaw_slider, "-180")
  346. ui_set(limit, "60")
  347. ui_set(edgeyaw, "Off")
  348. ui_set(freestanding, "-")
  349. ui_set(twist, true)
  350. ui_set(lby, false)
  351. end
  352. end
  353. end
  354. end
  355. if ui_get(desyncstyle) == "Jitter" then
  356. if (enemyclosesttocrosshair ~= nil) then
  357. yaw = calculateBestAngle(enemyclosesttocrosshair, -90, 90)
  358. if (yaw == -90) then
  359. ui_set(pitch, "Minimal")
  360. ui_set(base, "Local view")
  361. ui_set(yaw_slider, "8")
  362. ui_set(yawjitter, "Center")
  363. ui_set(yawjitter_slider, "-3")
  364. ui_set(bodyyaw, "Static")
  365. ui_set(bodyyaw_slider, "180")
  366. ui_set(limit, "60")
  367. ui_set(edgeyaw, "Off")
  368. ui_set(freestanding, "-")
  369. ui_set(twist, true)
  370. ui_set(lby, false)
  371. else if (yaw == 90) then
  372. ui_set(pitch, "Minimal")
  373. ui_set(base, "Local view")
  374. ui_set(yaw_slider, "-33")
  375. ui_set(yawjitter, "Center")
  376. ui_set(yawjitter_slider, "3")
  377. ui_set(bodyyaw, "Static")
  378. ui_set(bodyyaw_slider, "-180")
  379. ui_set(limit, "60")
  380. ui_set(edgeyaw, "Off")
  381. ui_set(freestanding, "-")
  382. ui_set(twist, true)
  383. ui_set(lby, false)
  384. end
  385. end
  386. end
  387. end
  388. if ui_get(desyncstyle) == "No fake" then
  389. if (enemyclosesttocrosshair ~= nil) then
  390. yaw = calculateBestAngle(enemyclosesttocrosshair, -90, 90)
  391. if (yaw == -90) then
  392. ui_set(pitch, "Minimal")
  393. ui_set(base, "Local view")
  394. ui_set(yaw_slider, "-90")
  395. ui_set(yawjitter, "Off")
  396. ui_set(bodyyaw, "Off")
  397. ui_set(edgeyaw, "Off")
  398. ui_set(freestanding, "-")
  399. ui_set(twist, false)
  400. ui_set(lby, false)
  401. else if (yaw == 90) then
  402. ui_set(pitch, "Minimal")
  403. ui_set(base, "Local view")
  404. ui_set(yaw_slider, "90")
  405. ui_set(yawjitter, "Off")
  406. ui_set(bodyyaw, "Off")
  407. ui_set(edgeyaw, "Off")
  408. ui_set(freestanding, "-")
  409. ui_set(twist, false)
  410. ui_set(lby, false)
  411. else if not (yaw == 90) and not (yaw == -90) then
  412. ui_set(pitch, "Minimal")
  413. ui_set(base, "Local view")
  414. ui_set(yaw_slider, "0")
  415. ui_set(yawjitter, "Off")
  416. ui_set(bodyyaw, "Off")
  417. ui_set(edgeyaw, "Off")
  418. ui_set(freestanding, "-")
  419. ui_set(twist, false)
  420. ui_set(lby, false)
  421. end
  422. end
  423. end
  424. end
  425. end
  426. else
  427. ui_set_visible(desynckey, true)
  428. ui_set_visible(indmulti, true)
  429. ui_set_visible(color, true)
  430. end
  431. lowestfov = 999
  432. lowestdmg = 999
  433. end)
  434.  
  435. -- Static body yaw
  436. client_set_event_callback("setup_command", function(cmd)
  437. if not ui_get(desync) or ui_get(desyncstyle) == "Off" or ui_get(desyncstyle) == "No fake" or entity_get_local_player() == nil or not entity_is_alive(entity_get_local_player()) then
  438. return
  439. end
  440. if cmd.in_jump ~= 0 then return end
  441. local sm = cmd.in_duck ~= 0 and 2.941177 or 1.000001
  442. sm = cmd.command_number % 4 < 2 and -sm or sm
  443. cmd.sidemove = cmd.sidemove ~= 0 and cmd.sidemove or sm
  444. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement