YaGame¶
YaGame
controls the players of a game.Functions¶
YaPlayerComponent GetLocalPlayer()¶
CLIENT ONLY
Returnsnull if local player does not exist (the client has not join a game)
Gets the local player.
Because a server does not represent a player, this API only works for the client and not a dedicated server.
YaPlayerComponent GetPlayer(number playerId)¶
Returnsnull if the player does not exist
Gets the player using the player ID provided.
playerId
The unique identifier of the player
Array<YaPlayerComponent> GetPlayers()¶
ReturnsA list of players in the current game
Gets a list of players in the current game.
YaEntity GetLocalPlayerEntity()¶
CLIENT ONLY
ReturnsLocal player entity
Gets the local player.
Because a server does not represent a player, this API only works for the client and not a dedicated server.
YaEntity GetPlayerEntity(number playerId)¶
ReturnsThe player entity
Gets the player entity using the player ID provided.
playerId
The unique identifier of the player
Array<YaEntity> GetPlayerEntities()¶
ReturnsA list of player entities in the current game
Gets a list of player entities in the current game.
Events¶
PlayerJoinedEvent<number>¶
Fired when a player joins the game.
playerId
The unique identifier of the player that joins the game
1 2 3 4 5 |
|
PlayerLeftEvent<number>¶
Fired when a player leaves the game.
To get the player, call
YaGame:GetPlayer(playerId)
instead of YaGame:GetPlayers()
.
playerId
The unique identifier of the player that leaves the game
1 2 3 4 5 6 7 |
|