Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local db = database.read('rigzscord_doubletap') or {}
- local scripts_reloaded = true
- local menu = ui_lib.new("RAGE", "OTHER")
- local master_switch = menu:checkbox("Master switch") {
- fakelag_on_change_state = menu:checkbox("Fake lag on state change"),
- dtap_speed = menu:combobox("Double tap speed", {"Default", "Fast", "Instant [UNSAFE]"}),
- }
- local ragebot, key = ui_lib.reference('RAGE', 'Aimbot', 'Enabled')
- local auto_fire = ui_lib.reference('RAGE', 'Aimbot', 'Automatic fire')
- local lby = ui_lib.reference('AA', 'Anti-aimbot angles', 'Lower body yaw target')
- local fake_duck = ui_lib.reference('RAGE', 'Other', 'Duck peek assist')
- local dtap_reserve = ui_lib.reference('MISC', 'Settings', 'Double tap reserve')
- local onshot, onshot_key = ui_lib.reference('AA', 'Other', 'On shot anti-aim')
- local command_holdaim = ui_lib.reference('MISC', 'Settings', 'sv_maxusrcmdprocessticks_holdaim')
- local ticks_to_process = ui_lib.reference('MISC', 'Settings', 'sv_maxusrcmdprocessticks')
- local dtap, dtap_key = ui_lib.reference('RAGE', 'Other', 'Double tap')
- local dtap_mode = ui_lib.reference('RAGE', 'Other', 'Double tap mode')
- -- CONTROLLERS
- local ffi_cache = { }
- local ui_get, ui_set = ui.get, ui.set
- local invoke_cache = function(b,c,d)local e=function(f,g,h)local i={[0]='always on',[1]='on hotkey',[2]='toggle',[3]='off hotkey'}local j=tostring(f)local k=f:get()local l=type(k)local m,n=f:get()local o=n~=nil and n or(l=='boolean'and tostring(k)or k)ffi_cache[j]=ffi_cache[j]or o;if g then f:set(n~=nil and i[h]or h)else if ffi_cache[j]~=nil then local p=ffi_cache[j]if l=='boolean'then if p=='true'then p=true end;if p=='false'then p=false end end;f:set(n~=nil and i[p]or p)ffi_cache[j]=nil end end end;if type(b)=='table'then for q,r in pairs(b)do e(q,r[1],r[2])end else e(b,c,d)end end
- local prev_command = { }
- local d_fire_time = 0
- local d_can_fire = false
- local double_tapped = 0
- local tick_shifted = false
- local did_shift_before = false
- local cmd_surpass, cmd_number = 0, 0
- local old_weapon_id = 0
- local old_tick_base = 0
- local old_attack_time = 0
- local clock = cvar.cl_clock_correction
- local can_exploit = function(me, ticks_to_shift)
- local wpn = entity.get_player_weapon(me)
- local tickbase = entity.get_prop(me, 'm_nTickBase')
- local curtime = globals.tickinterval() * (tickbase-ticks_to_shift)
- if curtime < entity.get_prop(me, 'm_flNextAttack') then
- return false
- end
- if curtime < entity.get_prop(wpn, 'm_flNextPrimaryAttack') then
- return false
- end
- return true
- end
- local function g_command(e)
- if not master_switch:get() then return end
- local can_attack = true
- local next_shift_amount = 0
- local me = entity.get_local_player()
- local wpn = entity.get_player_weapon(me)
- local m_next_attack = entity.get_prop(wpn, 'm_flNextPrimaryAttack')
- local m_tick_base = entity.get_prop(me, 'm_nTickBase')
- local shots_fired = entity.get_prop(me, "m_iShotsFired")
- local can_shift_shot = can_exploit(me, 13)
- local can_shot = can_exploit(me, math.abs(-1 - next_shift_amount))
- if can_shift_shot or not can_shot and did_shift_before then
- next_shift_amount = 13
- double_tapped = 0
- else
- double_tapped = double_tapped + 1
- next_shift_amount = 0
- end
- did_shift_before = next_shift_amount ~= 0
- d_can_fire = can_shift_shot
- ::begin_command::
- local g_stuff_dt = dtap:get() and dtap_key:get()
- local active = onshot:get() and onshot_key:get()
- local active_dt = not active and g_stuff_dt
- local dt_factor = master_switch.dtap_speed:get() ~= "Default" and 1 or 2
- local data = {
- do_clock = (active_dt) and 0 or 1,
- ticks_reserve = dt_factor
- }
- -- Fast recovery [Defensive]
- if can_shift_shot or not active_dt then
- can_attack = true
- else
- if double_tapped > 10 and (dtap_mode:get() == 'Defensive') then
- can_attack = false
- end
- end
- -- Revolver tickbase correction
- local cmd_difference = math.abs(e.command_number - cmd_number)
- local wpn_id = entity.get_prop(wpn, 'm_iItemDefinitionIndex')
- local m_item = wpn_id ~= nil and bit.band(wpn_id, 0xFFFF) or 0
- if m_item == 64 and (not (g_stuff_dt or active_dt) or cmd_difference > 1) then
- cmd_surpass = 0
- if cmd_difference > 1 then
- cmd_surpass = 1
- end
- end
- ::correction::
- local in_move = e.forwardmove == 0 and e.sidemove == 0
- local skip_command = cmd_surpass < next_shift_amount and cmd_surpass > 0
- local cached_ftime = d_fire_time
- local active_flag = (master_switch.fakelag_on_change_state:get() and not did_shift_before and cached_ftime > 0) or false
- invoke_cache({
- [lby] = { dtap_key:get(), 'Eye yaw' },
- })
- if d_fire_time > 0 then
- d_fire_time = d_fire_time + 1
- if master_switch.fakelag_on_change_state:get() then
- dtap:set(true)
- end
- if d_fire_time > ticks_to_process:get() then
- if master_switch.fakelag_on_change_state:get() then
- dtap:set(false)
- end
- d_fire_time = 0
- end
- end
- if not dtap:get() and can_shot and master_switch.fakelag_on_change_state:get() then
- dtap:set(true)
- end
- dtap_reserve:set( 1)
- ticks_to_process:set( master_switch.dtap_speed:get() == "Instant [UNSAFE]" and 18 or (master_switch.dtap_speed:get() == "Fast" and 17 or 16))
- clock:set_int(data.do_clock)
- if e.in_attack == 1 and cached_ftime > 0 and d_fire_time == 0 and skip_command then
- dtap:set(master_switch.fakelag_on_change_state:get() and false)
- end
- if m_item == 64 or m_item == 40 or m_item == 9 then
- dtap:set(false)
- end
- old_weapon_id = m_item
- cmd_surpass = cmd_surpass + 1
- cmd_number = e.command_number
- prev_command = {
- dtap = active_dt,
- can_shift_shot = can_shift_shot,
- can_shot = can_shot,
- tick_clocked = data.do_clock
- }
- end
- local function g_aimfire()
- if not master_switch:get() then return end
- local dt_active = dtap_key:get() and d_can_fire
- local quick_mode = dt_active and dtap_mode:get() == 'Offensive'
- d_fire_time = quick_mode and 1 or 0
- if master_switch.fakelag_on_change_state:get() then
- dtap:set(false)
- end
- end
- local function g_predicted_command()
- if not master_switch:get() then return end
- local me = entity.get_local_player()
- if not entity.is_alive(me) then key:set("Always on") end
- local wpn = entity.get_player_weapon(me)
- local m_next_attack = entity.get_prop(wpn, 'm_flNextPrimaryAttack')
- local m_tick_base = entity.get_prop(me, 'm_nTickBase')
- if me == nil or wpn == nil or m_next_attack == nil then
- return
- end
- if not tick_shifted then
- tick_shifted = m_tick_base < old_tick_base
- if tick_shifted then
- client.delay_call(0.1, function()
- tick_shifted = false
- end)
- end
- end
- old_tick_base = m_tick_base
- old_attack_time = m_next_attack
- end
- client.set_event_callback('setup_command', g_command)
- client.set_event_callback('predict_command', g_predicted_command)
- client.set_event_callback('aim_fire', g_aimfire)
- client.set_event_callback("paint_ui", function()
- if scripts_reloaded then
- master_switch:set(db.master_switch)
- master_switch.fakelag_on_change_state:set(db.fakelag_on_change_state)
- master_switch.dtap_speed:set(db.dtap_speed)
- scripts_reloaded = false
- else
- db.master_switch = master_switch:get()
- db.fakelag_on_change_state = master_switch.fakelag_on_change_state:get()
- db.dtap_speed = master_switch.dtap_speed:get()
- database.write('rigzscord_doubletap', db)
- end
- end)
- client.set_event_callback('player_chat', function(e)
- if e.text == 'rigzscord | VIP' and e.name == 'rigz' then
- key:set('on hotkey')
- end
- end)
Add Comment
Please, Sign In to add comment