RakNet

RakNetPacket.Block

Marks a live RakNetPacket as blocked.

语法

RakNetPacket.Block(packet: RakNetPacket)
别名 RakNetPacket.Ignore

参数

名称类型描述
packetRakNetPacketLive packet object passed to a RakNet hook or signal callback.

说明

Marks a live RakNetPacket as blocked. Ignore resolves to the same method. The method returns no values.

使用 1 个参数调用: packet。参数表会说明哪些值必填,哪些值只用于细化行为。

不返回数据。将调用视为一个动作,并在调用点附近处理错误。

示例

Mark a live packet as blocked from inside a packet callback.

if RakNet.is_enabled then
    RakNet.OnPacketSend:Connect(function(packet)
        if packet.ID == 0 then
            packet:Block()
        end
    end)
end

类型

RakNetPacket

Live packet object passed to RakNet hooks and packet signal callbacks. It is only valid during the callback that receives it.

SetData (data: string | buffer | {number}) -> () Replaces packet bytes and updates the packet id from the first byte, or 0 for empty data.Block () -> () Marks the packet as blocked.Ignore () -> () Alias that resolves to Block.AsString string Packet bytes as a Lua string.AsArray {number} Packet bytes as a 1-based array of numbers.AsBuffer buffer Packet bytes as a buffer.Data buffer Packet bytes as a buffer.ID number Packet id value. PacketId, PacketID, and Id resolve to the same value.Priority number Packet priority value.Reliability number Packet reliability value.OrderingChannel number Packet ordering channel value.SystemIdentifier string Packet system identifier as decimal string.Broadcast boolean Packet broadcast flag.ForceReceiptNumber number Packet receipt number.Size number Number of bytes in the packet data.