@infernus/raknet
v0.11.1
Published
A wrapper of the popular open.mp raknet plugin for samp-node.
Downloads
14
Maintainers
Readme
@infernus/raknet
A wrapper of the popular open.mp raknet plugin for samp-node.
You must use an existing polyfill or compile the corresponding GameMode based on it before you can use it.
Getting started
pnpm add @infernus/core @infernus/raknet
Example
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();
}