Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. local entity_get_local_player, entity_get_prop, bit_band, ui_get, math_abs = entity.get_local_player, entity.get_prop, bit.band, ui.get, math.abs
  2. local FL_ONGROUND = 1
  3. local MOVETYPE_LADDER = 9
  4. local yaw_prev, onground_prev = nil, false
  5.  
  6. --bypasses https://github.com/eedson/Cow-Anti-Cheat/blob/master/CowAntiCheat.sp#L810-L868
  7. local turn_right_prev = false
  8.  
  9. local function flag_set(flag, player)
  10. local player = player ~= nil and player or entity_get_local_player()
  11. if player == nil then
  12. return false
  13. end
  14. local flags = entity_get_prop(player, "m_fFlags")
  15. if flags == nil then
  16. return false
  17. end
  18.  
  19. return bit_band(flags, flag) == flag
  20. end
  21.  
  22. local enabled_reference = ui.new_checkbox("MISC", "Miscellaneous", "Legit air strafe")
  23. local hotkey_reference = ui.new_hotkey("MISC", "Miscellaneous", "Legit air strafe hotkey", true)
  24.  
  25. client.set_event_callback("setup_command", function(cmd)
  26. if not ui_get(enabled_reference) then
  27. return
  28. end
  29.  
  30. local onground = flag_set(FL_ONGROUND)
  31. if ui_get(hotkey_reference) and (not onground or not onground_prev) then
  32. if cmd.in_moveleft == 0 and cmd.in_moveright == 0 and cmd.in_speed == 0 and entity_get_prop(entity_get_local_player(), "m_MoveType") ~= MOVETYPE_LADDER then
  33. if yaw_prev ~= nil and (math_abs(cmd.yaw-yaw_prev) > 0.02) then
  34. cmd.in_forward = 0
  35. local turn_right = cmd.yaw < yaw_prev
  36. if turn_right or turn_right_prev then
  37. cmd.in_moveright = 1
  38. if turn_right then
  39. cmd.sidemove = 450
  40. end
  41. end
  42. if not turn_right or not turn_right_prev then
  43. cmd.in_moveleft = 1
  44. if not turn_right then
  45. cmd.sidemove = -450
  46. end
  47. end
  48. turn_right_prev = turn_right
  49.  
  50. if cmd.in_back == 1 then
  51. cmd.in_moveright, cmd.in_moveleft = cmd.in_moveleft, cmd.in_moveright
  52. cmd.sidemove = cmd.sidemove * -1
  53. end
  54.  
  55. --client.log("moveleft=", cmd.in_moveleft, " moveright=", cmd.in_moveright)
  56. end
  57. end
  58. end
  59. yaw_prev, onground_prev = cmd.yaw, onground
  60. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement