Hmm, this doesn’t look like any issue with fivem-js
. Code looks fine. Make sure the game type resource starts after the resource that this is in. Also use (global as any).exports
otherwise you’re using node-js exports module
New patch version v1.5.1! - New Menu features, World methods, Vehicle updates, performance improvements
Update v1.5.1
As always, simply npm i fivem-js@latest
to update your project.
Full Changelog
Highlights
- Fixed Game class
playerList
method - Fixed Menu UI screen and positioning issues
- Added Heritage panel and other menu panels
- Added
CursorPosition
to Hud class - Added
font
andscale
argument to `measureStringWidthNoConvert function - Added
Resolution
andScaledResolution
getter methods to Screen class - Added passing array of items to Container and Menu class
addItem
method - Added support for different screen resolutions and controls in Menu class
- Added
isDisabledControlReleased
andisDisabledControlJustReleased
methods - Added
NumberPlate
to Vehicle entity class (Thanks @DeForce) - Changed Sprite class constructor
pos
andsize
arguments from required to optional -
GameplayCamera
andRelativeHeading
are now static - Do not throw errors on UIMenuItem get methods that are not supported
- Overall Menu cleanup, changes, optimization
- Removed
refreshItems
method from Menu - Updated dependencies and documentation improvements
- Reduced module size to 831.4 kB (unpacked) from 1.4 MB
The majority of commits were done by @MythicalBro. Give him huge and thanks!
Thank you so much for your continued support and contributions!
-d0p3t
Okay so i’m starting with TypeScript, and using fivem-js i am not sure to understand how to correctly use the menu class.
To create a menu and display it, there is no issue at all it’s pretty easy to understand, but what i don’t understand is, if i create 3 button, how i add an action to a specific button, like the 2 second one, i want it to print test if i click it but not the others.
I saw the exemple, but it not helping me at all, the exemple just print for all buttons the same thing ( just depending if it’s a list / button etc )
If you could help me
New patch version v1.5.2! - Small patch to fix Vector3’s Length
Update v1.5.2
As always, simply npm i fivem-js@latest
to update your project.
Full Changelog
Highlights
- Fixed Vector3.Length (thanks @lfshr)
- Updated examples to use
fxmanifest.lua
- Deprecated all versions under 1.3.0. Please update
Extremely small update that I’d called this a minor minor patch, but it fixes a small issue some were having. And of course examples now use the good semantics
Thanks as always for the continued use of this. I am very happy to see JavaScript/TypeScript becoming so much more popular!
-d0p3t
Hi,
Happy to hear you’re getting into using Typescript.
You can identify various menu items and the actions on menu.ItemSelect.on
. For example, with the Text
, Description
(see Properties UIMenuItem)
You could also probably do:
theButton.activated.on(()=> {
// it's activated!
});
The above is the compliment of menu.itemSelect.on
and happens when you select it (see here)
Let me know if it works, it should
Ooh nice!
Will try that when i got time! Thanks!
Versus Lua, where would you say Javascript is development wise ? Is it completely supported, is it worth it to go down that route to develop in fiveM when you are a JS developer ?
Thank you
Completely supported. Use whatever you feel most comfortable with. This release is just some supportive stuff and is not required at all.
I kinda got started working on something with JS, but I had some issues I didn’t wanna take time for with npm packages and just went back to lua lol but thanks
@d0p3t Will it ever support the server side?