JSPM

@infernus/rec

0.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q23253F
  • License MIT

File format converter from `.rec` to `.json` and vice versa, which NPCs use in SA-MP to play back recordings.

Package Exports

  • @infernus/rec

Readme

@infernus/rec

npm npm npm bundle size

Getting started

pnpm add @infernus/rec

File format converter from .rec to .json and vice versa, which NPCs use in SA-MP to play back recordings.

Special thanks to samp-rec-to-csv.

Example

import type { RecordTypesEnum } from "@infernus/rec";
import {
  jsonToRec,
  recToJson,
  HeaderDataBlock,
  OnFootDataBlock,
  VehicleDataBlock,
} from "@infernus/rec";

const hdb = new HeaderDataBlock();
hdb.type = RecordTypesEnum.ONFOOT;

const odb = new OnFootDataBlock();
odb.position = [1.1145, 1.514, 1.1919];

const hdb1 = new HeaderDataBlock();
hdb1.type = RecordTypesEnum.DRIVER;

const vdb = new VehicleDataBlock();
vdb.position = [1.1919, 1.514, 1.1145];

const onFootRec = "./on_foot_data.rec";
const inCarRec = "./vehicle_data.rec";
const testRec = "./test.rec";

jsonToRec(onFootRec, [hdb, odb]).then(() => {
  recToJson(onFootRec).then((res) => {
    console.log(res);
  });
});

jsonToRec(inCarRec, [hdb1, vdb]).then(() => {
  recToJson(inCarRec).then((res) => {
    console.log(res);
  });
});

recToJson(testRec).then((res) => {
  console.log(res);
});