mp.players
Change a player's game and find players.
setMoney
mp.players.setMoney(player: PlayerRef, amount: number): voidSets the player's bank balance in the game.
giveMoney
mp.players.giveMoney(player: PlayerRef, amount: number): voidAdds to the player's bank balance (negative: takes from it, never below 0). Unlike setMoney it cannot overwrite what the player earned a moment ago.
repair
mp.players.repair(player: PlayerRef): voidRepairs the player's truck, trailers and cargo completely (the game's own repair).
cancelJob
mp.players.cancelJob(player: PlayerRef): voidCancels the player's active job (does nothing without one).
teleport
mp.players.teleport(player: PlayerRef, position: Vector3, heading?: number): voidMoves the player's truck to a position. heading in degrees (0 = north).
Types: Vector3
navigateTo
mp.players.navigateTo(player: PlayerRef, position: MapPoint | Vector3 | null): voidSets the destination of the player's navigation: the game plans the route to the nearest road within 200 m and shows its flag on the map and the route advisor. null takes the destination away. One destination per player - a new one replaces it (also a job's route).
setExperience
mp.players.setExperience(player: PlayerRef, xp: number): voidSets the player's experience points (0 to 100000000). The level follows from them.
setLevel
mp.players.setLevel(player: PlayerRef, level: number): voidSets the player's level (0 to 1000). Fractions are the progress into the next level, e.g. 12.5.
setExploration
mp.players.setExploration(player: PlayerRef, percent: number): voidSets how much of the map the player has explored, in percent (0 to 100): roads and visited cities.
setVehicle
mp.players.setVehicle(player: PlayerRef, name: TruckName | (string & {}), kind?: "truck" | "car" | "bus"): voidReplaces the player's vehicle with one defined in def/vehicle/<kind>_desktop/<name>.sii (or <kind>_cheat), e.g. "scania_s_2016" or "daf_2021". kind: "truck" (default), "car" or "bus". Names: lowercase letters, digits, _ . and /. Not possible while the player is on a job with another vehicle type.
setLicensePlate
mp.players.setLicensePlate(player: PlayerRef, text: string, country?: string): voidSets the license plate of the player's truck and its trailers (memory only). text: 1-12 of A-Z, 0-9, space, - and . (lower case is turned upper case); country: a country of the game whose plate design is used, default "germany". Every player starts with "OR MP 2026"; the plate stays after /model.
setTime
mp.players.setTime(player: PlayerRef, hour: number, minute?: number): voidSets the time of day in the player's game. The game's clock only runs forward: it jumps ahead to the next occurrence of that time. Nothing in between is simulated (unlike the game's own g_set_time, which plays the span through like sleeping). For the same time for everyone, use mp.world.setTime (as /time in freeroam does).
setWeather
mp.players.setWeather(player: PlayerRef, weather: Weather, smooth?: boolean): voidSets the weather in the player's game: "clear" or "rain" (ETS2 knows only these two; thunderstorms come with rain by chance). It changes at once (smooth is accepted but has no effect: the game's interpolated change never brought the rain). The game rolls the next weather by itself later (after tens of minutes, depending on the rule badWeather): to keep it, also set the rule - badWeather 0 = never rain, 1 = always rain. For everyone, use mp.world.setWeather.
Types: Weather
setFallbackVehicle
mp.players.setFallbackVehicle(player: PlayerRef, name: TruckName | (string & {}) | null, kind?: "truck" | "car" | "bus"): voidVehicle the player gets when pressing "Drive" without one of his own, instead of the game's "no vehicle" message. Defaults to fallback_vehicle in server.cfg. name like players.setVehicle; null = the game's message. kind: "truck" (default), "car" or "bus" (ETS2 1.61 has no drivable cars).
sendCompanyMessage
mp.players.sendCompanyMessage(player: PlayerRef, text: string): voidShows a message in the player's company message line (HUD, next to the navigation). Messages queue up and scroll through one after another (the game keeps up to 16). Plain text, at most 200 characters.
clearCompanyMessages
mp.players.clearCompanyMessages(player: PlayerRef): voidRemoves the shown company message and all waiting ones.
setCompany
mp.players.setCompany(player: PlayerRef, company: Company | null): voidPuts the player into a company of your gamemode, or out of every company with null (the game then shows no company). The game shows the company's name and logo as the player's own company in the top bar, and its Company menu category (with the mail) from the next desktop visit on. Memory only - nothing of the player's single-player company is changed on disk.
Types: Company
setFuel
mp.players.setFuel(player: PlayerRef, share: number): voidFills the truck's tank to a share of its size: 1 = full, 0.25 = a quarter.
setFatigue
mp.players.setFatigue(player: PlayerRef, minutes: number): voidHow long the driver has been driving without rest, in game minutes: 0 = fully rested (as after sleeping). Only matters with the fatigue rule on.
repairCargo
mp.players.repairCargo(player: PlayerRef): voidRepairs only the cargo of all the player's trailers (truck and trailer damage stay). players.repair repairs everything.
giveCargo
mp.players.giveCargo(player: PlayerRef, cargo: string, units?: number): voidGives the player a trailer loaded with this cargo (a cargo id of mp.world.cargo(), e.g. "apples") - without a job. units: number of units, leave out for the game's default.
fine
mp.players.fine(player: PlayerRef, offence: Offence, amount?: number): voidLets the game's police fine the player for an offence (the names of playerFined, e.g. "speeding") - at once, with the game's message, also without a police car around and with the "fines" rule off. amount in euro; leave out for the game's own amount. playerFined fires as for any fine.
teleportToJob
mp.players.teleportToJob(player: PlayerRef, withTime?: boolean): voidMoves the player to where their job continues: the trailer at the source, or the destination once loaded. With withTime the game time moves on as if they had driven (fuel, driving time); without, it is an instant jump.
teleportToCompany
mp.players.teleportToCompany(player: PlayerRef, company: string, city: string): voidMoves the player's truck to a company's depot (ids as in mp.world.companies(), e.g. "tradeaux", "dusseldorf"), facing into the yard. Throws if the depot is unknown or has no spawn point.
teleportToCity
mp.players.teleportToCity(player: PlayerRef, city: string): voidMoves the player's truck into a city: to one of its depots (mp.world data needed). Throws if the city has no depot with a spawn point.
setGhost
mp.players.setGhost(player: PlayerRef, on: boolean): voidGhost mode: the player drives through everyone and everyone through them - like in a safe zone, but everywhere. Their HUD shows "Ghost mode".
setVisible
mp.players.setVisible(player: PlayerRef, visible: boolean): voidfalse hides the player from everyone else: no truck, no name, not in the list - for admins watching or separate events. They see the others as before.
sendMail
mp.players.sendMail(player: PlayerRef, mail: Mail): voidPuts a mail into the player's mail screen in the game (desktop menu Mail), with the game's "new mail" mark - for welcome letters, rules, rewards. Needs subject or body. Mails live until the player leaves the server. The game's own mails (bank, dealers, ...) never arrive, and every player starts with an empty mail screen.
Types: Mail
kick
mp.players.kick(player: PlayerRef, reason?: string): voidKicks the player from the server.
all
mp.players.all(): readonly Player[]All connected players.
Types: Player
get
mp.players.get(id: number): Player | undefinedThe player with this id, or undefined.
Types: Player