Advertisement
kay1mov

Fake Lag CS 1.6

May 28th, 2025
616
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | None | 0 0
  1. import pydivert
  2. import time
  3. DELAY_SECONDS = 200 # DELAY MS
  4. DELAY_SECONDS /= 1000 # CONVERT TO SECONDS
  5.  
  6. LIMIT = 20 # MAX PACKETS TO DELAY
  7.  
  8. filter_str = "outbound and udp and udp.DstPort == 27015" # PORT MUST BE THE SAME AS THE SERVER
  9.  
  10. queue = [] # WE PUT ALL PACKETS HERE
  11.  
  12. with pydivert.WinDivert(filter_str) as w: # START LISTENING
  13.  
  14.     print(f"[*] Fake lag is active ({DELAY_SECONDS} sec and with packet limit {LIMIT})...")
  15.  
  16.     while True:
  17.         try:
  18.             packet = w.recv() # DELAYING PACKET
  19.             send_time = time.time() + DELAY_SECONDS #CALCULATE SEND TIME (CURRENT_TIME + DELAY)
  20.             queue.append((send_time, packet)) # APPENDING FOR QUEUE LIST
  21.         except Exception as e:
  22.             print(f"recv error: {e}")
  23.  
  24.         now = time.time() # CURRENT TIME
  25.         ready = [p for p in queue if p[0] <= now] #READY PACKETS, IF (CURRENT_TIME <= SEND TIME)
  26.         queue = [p for p in queue if p[0] > now] #ELSE
  27.  
  28.         for _, pkt in ready:
  29.             try:
  30.                 w.send(pkt) #SEND ALL PACKETS IN READY LIST
  31.             except Exception as e:
  32.                 print(f"send error: {e}")
  33.  
  34.         if len(queue) >= LIMIT: #CHECKING SIZE OF QUEUE, IF THERE MORE THAN LIMIT, WE SEND LAST PACKET
  35.             _, pkt = queue[-1]
  36.             w.send(pkt)
  37.  
  38.         time.sleep(0.001) # DONT KILL YOUR CPU :)
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement