Alias
raknet.OnPacketSend.Connect
Argumentos
(packet: RakNetPacket) -> ()
requerido
Function called with each observed outgoing RakNetPacket.
Retornos
RakNetSignalConnection
Connection object with Disconnect and Connected.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Connects a callback to the OnPacketSend signal table and returns a RakNetSignalConnection. The callback receives a RakNetPacket while the packet is valid.
RakNet.OnPacketSend.Connect(callback: (packet: RakNetPacket) -> ()): RakNetSignalConnection
raknet.OnPacketSend.Connect| Name | Type | Required | Descripción |
|---|---|---|---|
SetData | (data: string | buffer | {number}) -> () | Yes | Replaces packet bytes and updates the packet id from the first byte, or 0 for empty data. |
Block | () -> () | Yes | Marks the packet as blocked. |
Ignore | () -> () | Yes | Alias that resolves to Block. |
AsString | string | Yes | Packet bytes as a Lua string. |
AsArray | {number} | Yes | Packet bytes as a 1-based array of numbers. |
AsBuffer | buffer | Yes | Packet bytes as a buffer. |
Data | buffer | Yes | Packet bytes as a buffer. |
ID | number | Yes | Packet id value. PacketId, PacketID, and Id resolve to the same value. |
Priority | number | Yes | Packet priority value. |
Reliability | number | Yes | Packet reliability value. |
OrderingChannel | number | Yes | Packet ordering channel value. |
SystemIdentifier | string | Yes | Packet system identifier as decimal string. |
Broadcast | boolean | Yes | Packet broadcast flag. |
ForceReceiptNumber | number | Yes | Packet receipt number. |
Size | number | Yes | Number of bytes in the packet data. |
| Name | Type | Required | Descripción |
|---|---|---|---|
Disconnect | () -> () | Yes | Removes the connection from the packet signal. |
Connected | boolean | Yes | true while the connection still exists for the current RakNet hook generation. |
if not RakNet.is_enabled then
return
end
local connection = RakNet.OnPacketSend:Connect(function(packet)
print(packet.ID, packet.Size)
end)
task.wait(1)
connection:Disconnect()