Skip to main content

Packages & resources

SYNC MP finds and loads your code the same way RAGE:MP does: drop a folder in and it runs. There is no list of resources in the config.

Server-side JavaScript — packages/​

Every folder in packages/ with an index.js is a package:

packages/
├─ server/index.js ← "gamemode": "server" in conf.json → loads first
└─ admin/index.js ← every other folder loads after it, alphabetically
  • index.js runs on V8 with a Node.js compatibility layer: require(), module.exports, fs, path, events, timers, and the npm packages RAGE:MP gamemodes usually bundle.
  • The package named by "gamemode" in conf.json starts first. The others follow in alphabetical order.
  • Every package sees the same mp object, players and entities.
// packages/server/index.js
mp.events.add('playerJoin', (player) => {
player.spawn(new mp.Vector3(-425.5, 1123.6, 325.8));
player.call('welcome', [player.name]);
});

mp.events.addCommand('veh', (player, model) => {
mp.vehicles.new(mp.joaat(model || 'adder'), player.position, { dimension: player.dimension });
});

Server-side C# — dotnet/resources/​

With "csharp": "enabled" in conf.json, every folder in dotnet/resources/ that has a meta.xml is a C# resource:

<!-- dotnet/resources/MyMode/meta.xml -->
<meta>
<info name="MyMode" type="script"/>
<script src="bin/Release/net8.0/MyMode.dll"/>
</meta>
  • <script src> points at the built dll. If it is missing, the server also looks for MyMode.dll, bin/MyMode.dll and bin/{Debug,Release}/<tfm>/MyMode.dll.
  • A folder without meta.xml is treated as a library (for example a shared SDK your gamemode references) and is not started.
  • See First C# resource.

Client side — client_packages/​

The whole folder is downloaded by every player, and client_packages/index.js runs on the client (V8, modern JavaScript). require('./other.js') loads other files from the folder. See Client-side scripting.

JavaScript and C# together​

JS packages and C# resources can run on the same server at the same time. They share the same players and entities, and server events reach both.