network.block
Blocks a packet type.
Syntax
Signature
network.block(Id: number, Direction: string?) -> booleanAliases
raknet.blockpackets.blockRakNet.block
Parameters
| Parameter | Type | Description |
|---|---|---|
Id | number | Integer packet ID from 0 through 63. |
Direction | string? | Packet direction. Defaults to outgoing. |
Returns
| Type | Description |
|---|---|
boolean | Whether the blocking setting was accepted. |
Notes
Direction defaults to outgoing. Incoming aliases are incoming, receive, and received. Outgoing aliases are outgoing, send, and sent.
Example
Luau
local Direction = "outgoing"
local PacketId = 2 -- Chat
local WasBlocked = network.isblocked(PacketId, Direction)
if network.block(PacketId, Direction) then
print("Outgoing chat is blocked for five seconds")
task.delay(5, function()
if not WasBlocked then
network.unblock(PacketId, Direction)
end
end)
end