@nativewrappers/client
TypeScript icon, indicating that this package has built-in type declarations

1.7.33 • Public • Published

Notice for breaking changes

This library is going to be undergoing a rewrite over the next few months, backwards compatibility will not be guaranteed, if you want version thats guaranteed stable please look use 1.7.*

native-wrappers-client

🔥 A Javascript/Typescript wrapper for the FiveM natives 🎮

License: MIT npm version Workflow Status Last commit

Documentation - Forum

This is a continuation of fivem-js, who's maintainer has sadly passed away.

This project is in no way affiliated with FiveM or the Cfx Collective.

Functionality of this wrapper is based on the FiveM C# wrapper - link. It's a feature-rich set of helper classes, objects, and functions to help you develop your project faster.

Features

  • No runtime dependencies
  • Abstracts common used FiveM practices
  • Entity management through class objects (i.e. Vehicle and Ped entities)
  • UI elements such as scaleforms and loading prompts
  • Audio, Blips, Cameras and more...

In other words, whatever the FiveM C# wrapper can do, this package can as well and more!

Download & Install

yarn add @nativewrappers/client

or

npm i @nativewrappers/client

https://www.npmjs.com/package/@nativewrappers/client

Simple Usage

See here for example projects.

Typescript

import * as Cfx from '@nativewrappers/client';

RegisterCommand(
  'adder',
  async (source: number, args: string[]) => {
    const vehicle = await Cfx.World.createVehicle(
      new Cfx.Model('adder'),
      new Cfx.Vector3(1, 2, 3),
      4,
    );
    Cfx.Game.PlayerPed.setIntoVehicle(vehicle, Cfx.VehicleSeat.Driver);
  },
  false,
);

You can also individually import classes.

import { World } from '@nativewrappers/client/lib/World';

Javascript

/// <reference path="node_modules/@nativewrappers/client/lib/index.d.ts"/>
/// <reference path="node_modules/@citizenfx/client/natives_universal.d.ts"/>

const Cfx = require('@nativewrappers/client');

RegisterCommand(
  'adder',
  async (source, args) => {
    const vehicle = await Cfx.World.createVehicle(
      new Cfx.Model('adder'),
      new Cfx.Vector3(1, 2, 3),
      4,
    );
    Cfx.Game.PlayerPed.setIntoVehicle(vehicle, Cfx.VehicleSeat.Driver);
  },
  false,
);

Contributing

You are more than welcome to contribute to this project by submitting a pull request and creating issues.

Please checkout CONTRIBUTING.md for our contributing guidelines.

License

MIT with customization. See LICENSE

Package Sidebar

Install

npm i @nativewrappers/client

Weekly Downloads

124

Version

1.7.33

License

MIT

Unpacked Size

1.11 MB

Total Files

335

Last publish

Collaborators

  • dillskaggs