Blocking
Drop a packet id entirely, in both directions, with the script block list.
Drop a whole packet id without writing a hook. The client discards it in both directions. The script block list adds to the block list of the packet log and is cleared on Clear VM.
At a glance
xiao.packet.block(packet)
xiao.packet.block(packet: number | string)
The client drops this packet id in both directions.
Errors: an unknown name raises unknown packet '<name>', an id outside 0 to 1023 raises integer out of range.
xiao.packet.unblock(packet)
xiao.packet.unblock(packet: number | string)
Stops dropping it. The block list of the packet log is not changed.
xiao.packet.unblock_all()
xiao.packet.unblock_all()
Clears the script block list.
xiao.packet.is_blocked(packet)
xiao.packet.is_blocked(packet: number | string): boolean
Returns: true if the id is in the script block list. The block list of the packet log is not included.
Complete example
Block Animate for as long as the script lives:
xiao.packet.block("Animate")
print(xiao.packet.is_blocked("Animate"))
xiao.signal.add("unload", "restore", function() xiao.packet.unblock_all() end)