Open Road MP

Companies

Create your own companies and put players into them.

Every player starts on your server without a company: the game shows no company at all, and nothing of their single-player company (name, logo, fleet, mails) is visible. The game's Company category appears only for players in a company (from their next visit to the desktop), and it offers Mail only: the truck, trailer, driver and garage managers show the single-player fleet and stay locked. Without a company, Mail is under Career. Your gamemode can create its own companies and put players into them. Members see the company's name and logo as their own - in the top bar and in the game's company screens.

Create a company

const haulers = mp.companies.create({ name: "Nordic Haulers", logo: 4 })

mp.events.on("playerJoin", (player) => {
  haulers.add(player) // or: mp.players.setCompany(player, haulers)
})
  • name: 1-40 characters.
  • logo: one of the game's 16 company logos, 0 to 15 (default 0).

Change and leave

Name and logo can change at any time; every member sees it right away:

haulers.name = "Nordic Haulers AB"
haulers.logo = 7

haulers.remove(player)                 // the player has no company again
mp.players.setCompany(player, null)    // the same
mp.companies.remove(haulers)           // deletes it; members have no company afterwards

A player is in at most one company at a time - add takes them out of the previous one.

Read

player.company?.name          // "Nordic Haulers AB" or undefined
haulers.members               // online players in it
mp.companies.all()            // every company of this gamemode
mp.companies.get(1)           // by id

Companies live as long as your gamemode runs. A player who leaves is out of their company; when they come back, put them in again (e.g. in playerJoin).

The example gamemode freeroam has a window for it: /company (or /firma) founds a company, joins one or - for whoever founded it - changes name and logo; every member can leave. The code is in gamemodes/freeroam/company.ts; after founding, the founder gets a welcome mail.

On this page