Giter Club home page Giter Club logo

fivem-client's Introduction

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

fivem-client's People

Contributors

avarianknight avatar berkiebb avatar cyntaax avatar d0p3t avatar deforce avatar dreaming-codes avatar ekralc avatar github-actions[bot] avatar hellslicer avatar imckl avatar lemoncaikz avatar lfshr avatar liamdormon avatar mythicalbro avatar realstandal avatar user123441221 avatar william-des avatar wowjeeez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

fivem-client's Issues

[Request] Update known missing wrappers/fixes

Is your feature request related to a problem? Please describe.
I've noticed the former upstream repo from d0p3t has some forks that have a bunch of additions this repo doesn't, and vice versa. However, this repo/npm module looks more official, and updated more frequently.

Describe the solution you'd like
Grab the updates from the forks and merge in fixes/updates

Describe alternatives you've considered
I could possibly provide a PR once I get time to hand cherry-pick the changes. It might take a few days, but didn't want to start if there's no desire to consume the contributions.

Additional context
Let me know if either a) there's plans to gather changes from existing contributors, or b) it'd be acceptible to create a PR with the changes myself.

Examples of changes found in other forks:

  • Function documentation
  • Updated Enums
  • Updated namespaces
  • Useful functions (i.e., getting vehicles in a radius)
  • Updated missing Entities, and minor fixes to existing ones

[BUG] Menu text does not render

Describe the bug
When creating a menu the text is not being rendered.

To Reproduce
Steps to reproduce the behavior:

Sample code:

on('mojito_pdm:client:check_finance', async () => {
  const FinanceMenu = new Menu("PDM Finance Ltd", "Check your outstanding finance")
  FinanceMenu.Alignment = MenuAlignment.Right

  const Item = new UIMenuItem("Adder: ABC123", "Outstanding: $40,000")
  FinanceMenu.addItem(Item)
  FinanceMenu.open()
});

When triggering this event the menu and child item are created but the text is not rendered.

Expected behavior
The text should be rendered. This behaviour does not happen with the original fivem-js

Screenshots
This version:
native-wrappers-client

Original fivem-js:
fivem-js

FiveM Client (please complete the following information):

  • Canary: yes

FiveM Server (please complete the following information):

  • OneSync: on
  • Artifact: 4978

Additional context
Problem does not occur with the original fivem-js package, removing alignment options has no effect.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.