JSPM

@infernus/gps

0.0.3
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q28691F
  • License MIT

A wrapper of the popular SA-MP GPS plugin for samp-node.

Package Exports

  • @infernus/gps

Readme

@infernus/gps

npm npm npm bundle size

A wrapper of the popular SA-MP GPS plugin for samp-node, built-in WazeGPS.

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/gps

Example

import { WazeEvent, isValidWazeGPS, setPlayerWaze, stopWazeGPS } from "@infernus/gps";
import { PlayerEvent } from "@infernus/core";

PlayerEvent.onClickMap(({ player, fX, fY, fZ, next }) => {
  player.sendClientMessage(-1, "GPS set!");
  setPlayerWaze(player, fX, fY, fZ);
  return next();
});

PlayerEvent.onCommandText("stopgps", ({ player, next }) => {
  if (isValidWazeGPS(player)) {
    stopWazeGPS(player);
  }
  return next();
});

WazeEvent.onPlayerRouteFinish(({ player, finishedRoute, next }) => {
  player.sendClientMessage(
    -1,
    "Route finished!" + finishedRoute.tickPosition.toString(),
  );
  return next();
});