network object provides APIs for managing multiplayer games, including player management, groups, permissions, and messaging. Use network.mode to determine whether the game is running as a client, server, or in single player mode.
Properties
The current network mode:
"none"- Single player mode"server"- Multiplayer server"client"- Multiplayer client
The number of multiplayer groups in the server.
The number of players currently in the server.
All multiplayer groups within the server. Groups are used to assign roles and permissions to players.
All players currently in the server.
The player this instance of the game is controlling.
The default group ID that new players joining the server should be assigned to.
Various statistics related to networking.
Group Management
addGroup()
Creates a new multiplayer group for managing player permissions.getGroup()
Gets the player group with the specified ID.The group ID (or group index prior to API version 77).
removeGroup()
Removes the player group with the specified ID.The group ID (or group index prior to API version 77).
Player Management
getPlayer()
Gets the player with the specified ID.The player ID (or player index prior to API version 77).
kickPlayer()
Kicks the player with the specified ID from the server.The player ID (or player index prior to API version 77).
Messaging
sendMessage()
Sends a chat message to players.- Broadcast to All
- Send to Specific Players
The message text to broadcast to all players.
Messages are transmitted via the server even if the server is not a recipient.
Socket Operations
createListener()
Creates a new listener that can accept TCP connections on a given port.createSocket()
Creates a new TCP client that can connect to a server.Type Definitions
Player
Represents a player within a network game.The unique ID for the player.
The name of the player.
The group ID the player is a member of.
The latest measured ping in milliseconds.
The number of actions successfully executed by the player.
The total amount of cash spent from actions performed by the player.
The player’s IP address.
A hash of the player’s public key used for authentication.
PlayerGroup
Represents a group for assigning roles and permissions.The unique ID for the group.
The name of the group.
The permissions granted to players in this group. Can be:
"chat","terraform","set_water_level","toggle_pause""create_ride","remove_ride","build_ride","ride_properties""scenery","path","clear_landscape""guest","staff","park_properties","park_funding""kick_player","modify_groups","set_player_group""cheat","toggle_scenery_cluster","passwordless_login""modify_tile","edit_scenario_options"

