game service||doc135322

September 20, 2022

Game

Introduction

Game service, which records some information during the game, such as the number of players, teams, game duration, etc.


Function

Instance GetService (  string name  )

Get service

void TriggersAll (  string name  )

Trigger events for all entities in the current game

void GetStartGamePlayerCount (  )

Get the number of players at the start of the game

table GetAllPlayers (  )

Get an array of all players of the game

Player GetPlayerByUserId (  int userId  )

Get a player by player platform id

int GetAllPlayersCount (  )

Get the number of players in the current game

table GetSurvivePlayers (  )

Get all players alive in the current game

int GetSurvivePlayersCount (  )

Get the number of players alive in the current game

Team CreateTeam (  int id )

Create a team

boolean TryJoinTeamByPlayer (  Player player,  int teamId  )

Attempt to join the specified team

Team GetTeam (  int id,  boolean create  )

return team instance

void Exit (  Player player )

Quit the specified player from the game

void StopServer (  )

Shut down the server and disallow players from continuing to join


Event

trigger GAME_INIT

Triggered when the game is initialized

trigger GAME_START

Triggered when the game starts

trigger GAME_OVER

Triggered when game time ends

trigger GAME_EXIT

Triggered before game exit