1
player
Bruno Carneiro edited this page 2026-02-13 18:25:50 -03:00

Player

Kind: interface

Player represents a local or remote player. Mission scripts get the local player from GamePlay.gpPlayer() and remote players from GamePlay.gpRemotePlayers(). Player references are passed into many AMission events (e.g. OnPlayerConnected, OnPlaceEnter, OnOrderMissionMenuSelected).


Identity and connection

Method Return Description
string Name() string Player name.
bool IsConnected() bool Whether the player is connected.
int Channel() int Channel index.
string ConnectAddress() string Connection address.
int ConnectPort() int Connection port.
int Ping() int Ping (typically milliseconds).
string LanguageName() string Player language.

Army and place

Method Return Description
int Army() int Current army index.
AiActor Place() AiActor Actor the player is in (vehicle/aircraft); null if none.
int PlacePrimary() int Primary place (seat) index.
int PlaceSecondary() int Secondary place index.
AiPerson PersonPrimary() AiPerson Person (crew) in primary place.
AiPerson PersonSecondary() AiPerson Person in secondary place.
bool AutopilotPrimary() bool Autopilot on for primary place.
bool AutopilotSecondary() bool Autopilot on for secondary place.

Army selection and restrictions

Method Return Description
bool IsExpelArmy(int army) bool Whether the player is expelled from the army.
bool IsExpelUnit(AiActor unit) bool Whether the player is expelled from the unit.
void SelectArmy(int army) Select army for the player.

Entering and leaving places

Method Return Description
void PlaceEnter(AiActor actor, int indxPlace) Put the player into the given place (seat) of the actor.
void PlaceLeave(int indxPlace) Remove the player from the current place.

Usage

  • Use gpPlayer() for the local player and gpRemotePlayers() for others (e.g. to target HUD or log messages).
  • In OnPlaceEnter / OnPlaceLeave, the Player and placeIndex identify who entered which seat of which AiActor.
  • Use Army() to filter or assign sides; use Place() and PersonPrimary() / PersonSecondary() to know what the player is controlling.