Resources and scripting

A game mode is a set of packages: server packages run on the server, client packages are sent to players and run inside the game.

Project layout

my-server/
  conf.json              server settings
  packages/gamemode/     a server package (JavaScript, TypeScript or C#)
  client_packages/       code sent to players; index.js requires each folder
  game_resources/dlcpacks/   DLC packs
  plugins/               trusted native plugins
  tests/                 unit tests

Create one with node tools/nextmp.cjs init my-server --template typescript. Templates: js, typescript, csharp, mixed and freeroam.

Server packages

JavaScript and TypeScript packages run on the bundled Node.js; C# packages run on the bundled .NET, each in its own unloadable context. Both use the same RAGE-like API: mp.players, mp.vehicles, mp.objects, mp.peds, mp.blips, mp.markers, mp.checkpoints, mp.colshapes, mp.world, events, commands and procedures.

mp.events.add('playerJoin', player => {
    player.outputChatBox(`Welcome, ${player.name}!`);
});

mp.events.addCommand('veh', (player, fullText, name = 'adder') => {
    const vehicle = mp.vehicles.new(mp.joaat(name), player.position);
    player.putIntoVehicle(vehicle, -1);
});

An optional nextmp.json names the runtime, the main file and dependencies that must start first.

Client packages

Client code runs in a restricted V8 runtime inside the game: no Node.js, no file system, no network. It talks to the server with events and procedures, draws pages with mp.browsers, and calls a verified table of game functions through mp.game.

mp.events.add('welcome', text => mp.gui.chat.push(text));
mp.events.callRemote('ready');

What crosses the network

Events and procedures carry null, booleans, finite numbers, strings, arrays, plain objects and entity references, within size limits. A client can never use the name of a server event such as playerJoin, but it can send any other name: always check that the sender may ask for what an event requests.

Test without the game

  • @nextmp/testing loads your package in plain Node.js with a documented subset of mp.* and fails loudly on anything else.
  • Bots (node tools/nextmp.cjs bots) are real protocol clients for joins, events, reconnects and load.

Reference

Search the API catalogue, or read the full API reference in the server files (docs/api/server.md, client.md, csharp.md), TypeScript declarations in sdk/types and examples in sdk/examples. Compatibility with RAGE Multiplayer APIs is tracked entry by entry; not every RAGE function exists.