# net

Network manipulation and exploitation. Use these functions to control packet sending, choke commands, run server commands, block net messages, and read latency or server time.


# Packets & choking

# net.bsendpacket(state: boolean?): boolean

net.bsendpacket(state: boolean?): boolean
  • Controls whether the Source engine sends movement packets. Returns the previous state. Omit the argument to only read the current state.
local was = secret.net.bsendpacket(false) -- stop sending packets
secret.net.bsendpacket(was)               -- restore
local current = secret.net.bsendpacket()  -- read only

# net.choked(): number

net.choked(): number
  • Number of movement commands currently choked (not yet sent).
local n = secret.net.choked()
print("Choked commands:", n)

# CVars & disconnect

# net.setcvar(cvar: string, value: string)

net.setcvar(cvar: string, value: string)
  • Allows you to set a network variable (cvar) to a specified value.
secret.net.setcvar("name", "secretservice agent")

# net.disconnect(reason: string)

net.disconnect(reason: string)
  • Allows you to disconnect from a server with a custom disconnect reason.
secret.net.disconnect("Leaving")

# Commands

# net.stringcmd(cmd: string)

net.stringcmd(cmd: string)
  • Allows to send a string command from the client to the server.
secret.net.stringcmd("retry")

# Blocking

# net.block(cmd: string, writestring: boolean)

net.block(cmd: string, writestring: boolean)
  • Allows you to block a net message from being sent.
secret.net.block("anticheat_ban", false) -- this blocks net.Start, true will block net.WriteString

# net.unblock(cmd: string, writestring: boolean)

net.unblock(cmd: string, writestring: boolean)
  • Allows you to unblock a blocked net message.
secret.net.unblock("anticheat_ban", false) -- this unblocks net.Start, true will unblock net.WriteString

# Time & latency

# net.get_latency(flow: number): number

net.get_latency(flow: number): number
  • Returns the current network latency for the specified direction.
  • flow must be 0 (outgoing) or 1 (incoming). Any invalid value defaults to 0.
local latency_out = secret.net.get_latency(0) -- gets outgoing latency
local latency_in = secret.net.get_latency(1) -- gets incoming latency

# net.server_time(offset: number): number

net.server_time(offset: number): number
  • Returns the predicted server time based on the local player’s tickbase.
  • If offset is provided, it shifts the tickbase by that amount.
-- get current predicted server time
local time = secret.net.server_time()

-- get server time 2 ticks ahead
local future = secret.net.server_time(2)

print("current:", time, "future:", future)