Out Packet
Create and send custom packets to the server.
Important
Sending invalid or malformed packets can cause disconnection. Only use if you understand the packet structure.
Example Disclaimer
Examples use placeholder opcodes for demonstration only. Research actual packet structures for your game version.
Constructor
out_packet(opcode: number) -> OutPacket
Creates a new packet with the specified opcode.
lua
local packet = out_packet(0x100)Encoding Methods
All methods return the packet object for method chaining.
packet:encode_1(value: number) -> OutPacket
Encodes 1 byte (0-255).
packet:encode_2(value: number) -> OutPacket
Encodes 2 bytes (0-65535).
packet:encode_4(value: number) -> OutPacket
Encodes 4 bytes (0-4294967295).
packet:encode_8(value: number) -> OutPacket
Encodes 8 bytes.
packet:encode_string(text: string) -> OutPacket
Encodes a string.
packet:encode_buffer(data: string) -> OutPacket
Encodes raw binary data.
Utility Methods
packet:to_string() -> string
Returns hexadecimal representation of packet contents.
packet:send()
Sends the packet to the server.
Examples
Basic Usage
lua
-- Create and send packet
local packet = out_packet(0x100) -- Use real opcode
packet:encode_1(5)
packet:encode_2(1000)
packet:send()Method Chaining
lua
out_packet(0x200)
:encode_1(10)
:encode_2(500)
:encode_4(100000)
:encode_string("Hello")
:send()