0.0.1 • Published 10 months ago

@infernus/gps v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@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();
});
0.0.1

10 months ago