Skip to content
M2O Scripting APIScripting reference
Global objectClient APIGenerated

Radio

const Radio: object

Defined in: client/api.d.ts:875

Reads and controls the local player’s in-car radio. Control is local (not synced to other players) and is rejected while the server has locked the vehicle’s radio.

getStation(): number | null

Gets the currently tuned station id.

number | null

The station id, or null when the radio is off or no station is tuned.

getStationCount(): number

Gets the number of loaded stations.

number

The station count (0 before radio content has streamed in).

getStationId(name): number | null

Resolves a station name to its id.

string

Station name, e.g. “Empire”.

number | null

The station id, or null when no station has that name.

getStationName(): string | null

Gets the name of the currently tuned station.

string | null

The station name, or null when off or the station name is unknown.

getStations(): string[]

Lists the names of the currently loaded stations.

string[]

An array of station names (empty before radio content has streamed in).

isAvailable(): boolean

Checks whether the local player is the active driver of a car with a radio receiver.

boolean

True when the in-car radio can be read or controlled.

isLocked(): boolean

Checks whether the server has locked this vehicle’s radio, which rejects local control.

boolean

True when the server owns the radio state.

isOn(): boolean

Checks whether the radio is currently powered on.

boolean

True when the radio is on.

next(): boolean

Tunes to the next station, wrapping around.

boolean

True when applied; false when unavailable, server-locked, or no stations are loaded.

previous(): boolean

Tunes to the previous station, wrapping around.

boolean

True when applied; false when unavailable, server-locked, or no stations are loaded.

setStation(station): boolean

Tunes the radio to a station and turns it on.

string | number

Station id or station name to tune to.

boolean

True when applied; false when unavailable, server-locked, or the station is invalid.

turnOff(): boolean

Powers the radio off.

boolean

True when applied; false when unavailable or server-locked.

turnOn(): boolean

Powers the radio on.

boolean

True when applied; false when unavailable or server-locked.