Repository navigation
Raw RPC and Packets
Use context.SF.Samp.Packets and Rpc for copied raw frames. SubscribeIncoming/Outgoing accepts numeric IDs; StreamIncoming/Outgoing additionally accepts a cancellation token. Register disposable callbacks with the module context and end stream enumeration during stop.
ReadOnlyMemory in a frame owns managed bytes detached from native memory. Keeping frames keeps their buffers alive. Incoming RPC data can include a header and an unaligned payload: preserve DataBitOffset and DataBitLength. Byte slicing at offset/8 is incorrect for unaligned data. Outgoing RPC generally supplies payload only. Packets include their ID.
Subscriptions route by original wire ID. Incoming(207) does not implicitly include a timestamp-wrapped 207; subscribe to 40 as well and inspect EffectivePacketId. See timestamp rules.
RegisterIncomingFilter/RegisterOutgoingFilter exist for packets and RPCs, either by ID or catch-all. A true result drops the message; false passes it. Filters run synchronously on the hook thread, not the game-thread dispatcher. Do not block, allocate, perform I/O, call native UI, await or retain the supplied span. Do not register resources there.
SendPacket takes a complete packet. SendRpc takes a separate ID, payload and payload bit length. SimulateIncoming methods enqueue synthetic input locally and do not contact the server. All transport calls require the game thread. Encoding and bit windows remain the caller's responsibility; managed bitstreams help construct valid layouts.
See full examples, ISFPackets, filter delegates and IncomingRpcFrame.
- Главная / Home
- Установка
- Архитектура и совместимость
- SA-MP R1, R3-1, R5-1
- Написание модулей
- Плагины и зависимости
- Жизненный цикл
- API модулей
- Потоки и время жизни
- Ранняя загрузка
- Конфигурация и ассеты