@infernus/raknet
v0.14.0
Published
A wrapper of the popular open.mp raknet plugin for samp-node.
Maintainers
Readme
@infernus/raknet
A wrapper of the popular open.mp raknet plugin for samp-node.
Polyfill-free edition (v0.14.0+)
Starting from v0.14.0, the #include <polyfill/raknet> directive is no longer required.
Note: The
polyfill_raknet.pwngamemode must be recompiled. You must use our latest forked version of Pawn.RakNet: dockfries/Pawn.RakNetAdditionally, download the latest samp-node build and overwrite your existing one: dockfries/samp-node
⚠️ The polyfill-free edition is experimental — bugs may be present. If you rely on the polyfill-based approach, please stay on
@infernus/[email protected]with the original Pawn.RakNet.
Getting started
pnpm add @infernus/core @infernus/raknetExample
import { Player } from "@infernus/core";
import { BitStream, IPacket, PacketIdList, OnFootSync, BulletSync } from "@infernus/raknet";
import type { IBulletSync } from "@infernus/raknet";
IPacket(PacketIdList.OnFootSync, ({ playerId, bs, next }) => {
const sync = new OnFootSync(bs).readSync();
console.log(playerId, sync);
return next();
});
function sendBulletData(from: Player, to: Player | -1, data: IBulletSync) {
const bs = new BulletSync(new BitStream());
bs.writeSync(data);
bs.sendPacket(to);
bs.delete();
}