---
title: Example package
description: Working SixL example packages to start from: hello (a server and a client part, a greeting, a marker and a blip) and freeroam (a small game mode with chat commands, vehicles, teleports, damage, respawn and blips).
---

# Example package: hello

`hello` is the smallest useful package. It has a server part and a client part and shows how they talk to each other. It does four things:

- greets every player when their client is ready;
- answers the chat command `/hello`, typed in the built-in chat, with a greeting on the screen and a line in the chat;
- sends the same greeting when the player presses **H** (an extra: the client script asks the server for it with an event);
- puts a marker and a blip five metres from the first player who becomes ready.

The example is the folder `examples/hello` of the server sources. Its layout matches the server folder you run, so you copy it over:

```
hello/
  node/packages/hello/index.js          server part
  client_packages/index.js              the entry of the client scripts: loads ./hello
  client_packages/hello/index.js        client part
  client_packages/hello/ui/hello.html   the page that shows the greeting on the screen
```

## Install

1. Stop the server if it is running.
2. Copy the contents of the `hello` folder into your server folder:
   - **Windows archive:** copy `node\packages\hello` into the archive's `node\packages` folder, and `client_packages` into the archive's `client_packages` folder (merge the folders; if you already have a `client_packages\index.js`, add the line `require('./hello');` to it instead of replacing the file).
   - **Linux container:** copy `node/packages/hello` into the `packages` folder and `client_packages` into the `client_packages` folder next to `compose.yml`.
3. Start the server (see [Server configuration](server-config.md)). The log shows `loading package hello`, then `[hello] loaded`.

The `resources.watch` setting rebuilds the client files by itself when they change, but a server script is read only at start: restart the server after you change `node/packages/hello/index.js`.

## Run

1. In the launcher use "Connect by address" and enter your server's address (`127.0.0.1:31130` on the same computer).
2. When you are in the game, the greeting `Hello, <your name>!` appears at the top of the screen for a few seconds.
3. Press **H**: the greeting appears again. The server log shows `[hello] greeted <name>`.
4. Press **T**, type `/hello` and press Enter: the same handler runs, the greeting appears on the screen and a `Hello, <your name>!` line appears in the chat. The built-in chat sends a line that starts with `/` as a command. See [Events](events.md#chat-commands).

The marker and the blip are created on the server once, five metres from the first player who becomes ready (the server waits for that player's first real position, at most 10 seconds). The marker is streamed to players who come within the server's `streamingRange`; the blip is sent to every player.

## How it works

- On `playerReady` the server package calls `player.spawn(position, heading)` to put the player on an open street: the server decides where a player appears, as in RAGE MP (the game's own save may start a player inside a house). The marker goes five metres from that point.
- The server package registers `mp.events.addCommand('hello', ...)` for the command (it answers with `player.outputChatBox`) and `mp.events.add('hello:request', ...)` for the event the client sends.
- To greet, the server calls `player.call('hello:greet', text)`. The client script receives it with `mp.events.add('hello:greet', (text) => {})` and passes the text to a browser page with `box.call('show', text)`.
- The client script binds the H key with `mp.keys.bind(0x48, false, ...)` and sends `mp.events.callRemote('hello:request')`.
- The marker and the blip come from `mp.markers.new` and `mp.blips.new`, with the named VI colour `mp.blips.colours.cyan`.
- The page is `package://hello/ui/hello.html`, that is the file `client_packages/hello/ui/hello.html`, which players download when they join ([Resources and packages](packages.md)).

Each step above was checked in the game: the greeting when the client is ready, the **H** key, the `/hello` command, the page loading from `package://hello/ui/hello.html`, the marker next to the player and the blip. For how the game shows each kind of marker and blip, see the member in the API reference.

Change the files, restart the server, join again, and players receive the changed client files.

## A game mode: freeroam

`freeroam` is a small but complete game mode to start your own from. It is server-only: the player sees it through the built-in chat and the map, so there is nothing to put into `client_packages`.

- A player whose game has loaded appears at the spawn point and gets a welcome line in the chat; everyone sees who joins, who leaves and who was killed.
- Chat commands: `/help`, `/veh [name]` (a vehicle in front of you; your previous one goes away), `/tp <x> <y> <z>`, `/tp <player id or name>`, `/tp spawn`, `/weapon <hash> [ammo]` (a weapon by the game's own hash: the example ships no list of weapons), `/hp`, `/pos`.
- Damage: a hit a player's game reports is a request; the mode checks it (the same dimension, the distance, a sane amount) and applies it, armour first. A killed player appears at the spawn point again after a few seconds.
- Blips at the points listed in its `config.json`, which also holds the spawn point, the vehicle names, the welcome line and the limits.

It is the folder `examples/freeroam`; copy its `node/packages/freeroam` into your server's `node/packages` (the Windows archive) or `packages` (the Linux container) and restart the server. Its `README.md` lists every command and setting. The vehicle names in its `config.json` are GTA VI vehicles; add a name only after you have seen it appear in the game.
