Skip to content

altmp/altv-js-module-v2

Repository files navigation

alt:V JS module v2

Repository containing the new JS module v2 module for alt:V multiplayer.

Structure

Directory Description
/client Clientside JS module powered by V8
/server Serverside JS module powered by Node.js
/shared Shared code for the clientside & serverside module
/docs Documentation for the internal workings of the module
/deps Global dependencies
/tools Scripts for any tooling related to the module
/types Typings for the API

Contributions

All contributions are greatly appreciated. If there are any questions or you would like to discuss a feature, contact the module maintainer.

Installing Module

As server developer

Create .altvpkgrc.json in your server directory (directory where you have altv-server binary):

{
    "loadJSV2Module": true
}

Use altv-pkg to install all needed binaries:

npx altv-pkg release

Create resource with resource.toml containing the following:

type = 'jsv2'
main = 'server.js'
client-type = 'jsv2'
client-main = 'server.js'

# Uncomment if you want to use v1 API (alt-server, alt-client modules)
# [js-module-v2]
# compatibilityEnabled = true

As contributor

Installing the Module on the Client

NOTE: It's only needed if you are contributing or debugging the module, normally it's shipped with alt:V client on release and rc branches

NOTE: Client modules are only loaded when you are on the dev branch and have debug mode enabled.

  1. Download the latest js-module-v2-windows-client.zip file from the Releases page.

  2. Copy the modules folder into your alt:V client directory (the folder where altv.exe is located).

  3. Once you start alt:V, a popup will appear, asking whether you want to run unofficial modules. Click "Yes"

Installing the Module on Your Server

NOTE: Your server must be on the latest dev branch for the module to load correctly.

  1. Download the latest js-module-v2-windows-server.zip or js-module-v2-linux.zip file from the Releases page.

  2. Copy the modules/js-module-v2.* files (for Windows) or libjs-module-v2.so file (for Linux) into your server's modules folder.

  3. Copy the libnodev2.dll file (for Windows) or libnodev2.so file (for Linux) into the root folder of your server, where your altv-server.exe (for Windows) or altv-server (for Linux) executable is located.

  4. Load the module by adding 'js-module-v2' to the array of modules in your server.toml file.

  5. Create a resource with type = "jsv2" and client-type = "jsv2" in resource.toml file.

Alternatively, you can also download the server module from the official alt:V CDN server:

v1 Compatibility

Add this to resource.toml to use v1 API (alt-client, alt-server, etc.)

[js-module-v2]
compatibilityEnabled = true