Fivem-js v1.5.2 - Javascript/Typescript wrapper - Now with Menu class (NativeUI)!

New version is out v1.2.0! Mainly refactoring, but also new features to Raycasting, Weather and Audio.

Also added CircleCI for PR checks. See here


Update v1.2.0

Full Changelog

Highlights

  • Working Raycasting - v1.1.1 had bugs calculating the forward vector causing hit position to be off.
  • Refactoring to enums, hashes, models, ui, everything. This allow for better development + accessibility.
  • Models now get freed after requesting
  • Play/Stop audio sounds
  • Additions to World class regarding (game) time, manipulating weather and cloudhats.

We had another PR from Hellslicer and also a new community member who is creating his own gamemode using Typescript + React. Glad to see new members explore languages out side of Lua!

-d0p3t

1 Like

I’m currently unable to use version 1.2.0 of fivem-js, whenever I import it the script throws the following error:

class UIMenuCheckboxItem extends _1.UIMenuItem {
----------------------------------------------------------------^

TypeError: Class extends value undefined is not a constructor or null
at Object.defineProperty.value (\server-data\resources\test-resource\dist\index.js:3999:37)

Downgrading to 1.1.1 imports fine and I’m able to use it… Unsure if it’s something I’m doing wrong, any help would be appreciated :slight_smile:

I’ll look into it over the weekend.

Could be because of a missing export but I don’t see it at first glance.

1 Like

Minor patch v1.2.1 - Fixes some export issues that caused certain features to not work. For example, the issue @LemonCaik had above. There were several others that got my attention regarding this. Thank you for the patch Lemon!


Update v1.2.1

Full Changelog

Highlights

  • Fixed export order.

That’s it! Just a small patch. Simply update the version using npm or install it like normal.

-d0p3t

I’ve tried to clone your javascript example. When i try to run it doesn’t recognize webpack. So i install it using npm install. I then get my dist file. But it doesn’t recognize the fivem-js package…Whenever i remove the code and the import my script is recognizable…When I put it back it doesn’t do anything. What am I missing? I assume it has something to do with using a seperate webpack? Should it be recognizing fivem’s webpack?

Minor patch v1.2.2 - This time I actually merged the changes of @LemonCaik which should fix the issues with the menu UI that was present since the introduction of v1.2

Update v1.2.2

Full Changelog

Highlights

  • Fixes issue with menu imports

That’s all for today :slight_smile:

-d0p3t

Just a heads up that v1.3.0 is close! I expect to push it live this week if I don’t forget and finish some things I’d also like to push, like support for all resolutions for the menu.

1 Like

New minor version v1.3.0! - A lot of changes that will impact the way you use the wrapper. Nothing major, but enough so you have to adapt your own scripts. Therefore minor version upgrade. Oh and some small neat UI features.


Update v1.3.0

Full Changelog

Highlights

  • BREAKING New linting config - What does this mean for you? All methods are now in lowerCamelCase, so please edit your scripts accordingly. If you use Typescript or reference properly in Javascript you should be getting linting errors :slight_smile:

  • Timerbar class - Pretty timerbars to create those fancy race and mission gamemodes! Example:
    FiveM_GTAProcess_2019-05-04_22-21-20
    What’s that? A loading prompt? :open_mouth: Yes! Timerbars take into account loading prompts, look. Click me

  • Vector3’s now function properly (Oops!) - Thanks @zr0iq!

  • New fancy drawing of… lines, spotlights, things like that


I had planned to include some new menu UI items, but they didn’t make it into this version. Still working on them, but will be added next big patch!

Have any ideas? Share them below or here.

As always, that’s it!

-d0p3t

3 Likes

When I use the Menu Example along with NativeUI the menu doesnt work in game

I never saw this, not sure how :joy: I love the implementation of time bars, definitely going to use this!

this is so good!!! I can finally do something rather than discord js now i can do fivem js

1 Like

is there any update on this or any future updates also is there any tutorials on this?

There are examples that can be found in the source code repository https://github.com/d0p3t/fivem-js/tree/master/examples

I have actually pushed a hotfix not too long ago and have a couple of changes locally, but haven’t updated this topic. My focus has gone elsewhere over the past couple of months and I don’t feel like there’s much to add in this.

If you have anything you feel is missing and could be useful, let me know here or write a suggestion here

Don’t forget there’s also the documentation! https://d0p3t.nl

New patch version v1.3.1! - More documentation, Linux compatibility fix, updated examples and new way to add submenus to Menu class.


Update v1.3.1

Full Changelog

Highlights

  • Add more documentation to various classes - still at https://d0p3t.nl
  • Updated examples to use newest fivem-js and other dependencies
  • Updated project dependencies
  • Submenus can now be added more easily. Thanks @MythicalBro. Example:
let MainMenu = new Cfx.Menu("MythicalBro", "options");

let SubMenu = MainMenu.addNewSubMenu('SubMenu', 'Some description');

let NewMenu = new Cfx.Menu('NewMenu', 'Subtitle', new Point(20, 30));
MainMenu.addSubMenu(NewMenu, 'NewMenu', 'Some description');

That’s it :slight_smile:

-d0p3t

1 Like

New patch version v1.3.2! - Weapons, fading, and scaleform improvements. Bug fixes


Update v1.3.2

Full Changelog

Highlights

  • Added give/remove weapons in Ped class
  • Improved screen fading in/out
  • Improved scaleform loading and added setDuration(ms) method
  • Documentation comments

That’s it :slight_smile:

-d0p3t

2 Likes

New patch version v1.3.3! - Ped Iterator, New Entity Methods, Dependency Updates and Bug fixes


Update v1.3.3

Full Changelog

Highlights

  • Camera.pointAt() and Camera.attachTo() now supports Ped bones
  • Getter/setter for Radio Station - See pull/35 by Jamelele
  • Experimental Ped iterator - World.getAllPeds() - Please report issues.
  • Entity damage related methods
  • Entity surroundings related methods (e.g. isNearEntity, isInRangeOf)
  • Ped bones
  • Notifications with icon

That’s it :slight_smile:

-d0p3t

I’ve been hearing some people would like to have a more advanced NativeUI. What other features would you guys like to see?

I think this wrapper needs some love :slight_smile:

2 Likes

Hello ,
I’ve been on FiveM for 3 years now, I’m a developer on a lot of servers, and now I want to learn another language like TypeScript.
I’d like to have more information, because I want to work underneath. Already for me and why not create a server in TypeScript.
Please I am looking for a person who can really help me I am not 15 years old I can tell you.

New patch version v1.4.0! - Improvements to Scaleform, Entities, Blips, World, Dependency Updates and lots of Bug fixes


Update v1.4.0

As always, simply npm i fivem-js@latest to update your project.

Full Changelog

Highlights

  • Added Quaternion class
  • Added tons of methods to all Entity types (Peds, Vehicles, Props)
  • Added Blip class with methods for easy blip management
  • Added createProp to World class
  • Fixed getAllPeds, getAllProps, getAllVehicles enumeration from World
  • Various bug fixes to String class that in turn fix bugs from Menu UI classes
  • Fixed Scaleform loading and changed visibility of some methods/properties
  • Updated dependencies and documentation improvements

The majority of commits were done by @MythicalBro. See pull/39.

Thank you so much for your continued support and contributions! :heart_eyes:

-d0p3t

1 Like

First of all thanks for your hard work, @d0p3t, I’m getting started with fivem-js, using Typescript. Everything is working perfectly and it’s really a great way to get started, 3 billion times easier than basic natives. The thing is that I’m trying to export another script function, “spawnmanager” but it isn’t working. This is the script I’m trying to run:

on('onClientGameTypeStart', () => {
    exports.spawnmanager.setAutoSpawnCallback(() => {
        exports.spawnmanager.spawnPlayer({
          x: 686.245,
          y: 577.950,
          z: 130.461,
          model: 'a_m_m_skater_01'
        }, () => {
          emit('chat:addMessage', {
            args: [
              'Hi, there!'
            ]
          })
        });
      });
    
      exports.spawnmanager.setAutoSpawn(true)
      exports.spawnmanager.forceRespawn()
});

On client.ts, I don’t know if you could give a little clue.

Thx and another time, thank you for the great job that Fivem-js is :slight_smile: