Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- local FL_ONGROUND = 1
- local MOVETYPE_LADDER = 9
- local yaw_prev, onground_prev = nil, false
- --bypasses https://github.com/eedson/Cow-Anti-Cheat/blob/master/CowAntiCheat.sp#L810-L868
- local turn_right_prev = false
- local function flag_set(flag, player)
- local player = player ~= nil and player or entity_get_local_player()
- if player == nil then
- return false
- end
- local flags = entity_get_prop(player, "m_fFlags")
- if flags == nil then
- return false
- end
- return bit_band(flags, flag) == flag
- end
- local enabled_reference = ui.new_checkbox("MISC", "Miscellaneous", "Legit air strafe")
- local hotkey_reference = ui.new_hotkey("MISC", "Miscellaneous", "Legit air strafe hotkey", true)
- client.set_event_callback("setup_command", function(cmd)
- if not ui_get(enabled_reference) then
- return
- end
- local onground = flag_set(FL_ONGROUND)
- if ui_get(hotkey_reference) and (not onground or not onground_prev) then
- 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
- if yaw_prev ~= nil and (math_abs(cmd.yaw-yaw_prev) > 0.02) then
- cmd.in_forward = 0
- local turn_right = cmd.yaw < yaw_prev
- if turn_right or turn_right_prev then
- cmd.in_moveright = 1
- if turn_right then
- cmd.sidemove = 450
- end
- end
- if not turn_right or not turn_right_prev then
- cmd.in_moveleft = 1
- if not turn_right then
- cmd.sidemove = -450
- end
- end
- turn_right_prev = turn_right
- if cmd.in_back == 1 then
- cmd.in_moveright, cmd.in_moveleft = cmd.in_moveleft, cmd.in_moveright
- cmd.sidemove = cmd.sidemove * -1
- end
- --client.log("moveleft=", cmd.in_moveleft, " moveright=", cmd.in_moveright)
- end
- end
- end
- yaw_prev, onground_prev = cmd.yaw, onground
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement