Players.refresh(); // rebuild all the players objects
Parameters
The function does not care whether you are brave, stupid or terminally-inquisitive.
Return value
Does not return anything other than a nagging doubt that you just did something stupid.
Notes
All Players Objects will be rebuilt. Some important things to note:
All caches associated with the Players API will be invalidated
Any players which are not alive at the time of the refresh will be marked as vacant slots.
Spectator detection will be disabled if the game is more than a few seconds old. So, even if there are spectators, they will not be marked as spectators and will start being treated as enemies or allies. You can override this by defining a custom isSpectator() function.
Any mods targeted at Players Objects will be reapplied after the objects are rebuilt. Mods can supply their own refresh functions to be called after being re-applied if desired.
The only time this should be used is during an eventStartLevel() that is caused by using loadLevel() – in this scenario the player has just started a new "level" (map) within the current game, or something like that. The loadLevel() function and it's effects are not yet fully understood.
If in doubt, don't use Players.refresh()!
Example
Tempting fate...
Players.refresh(); // are you really sure you want to do this?
isSpectator() — A global function that performs a basic, un-cached check to determine if a player is a spectator based on presence of a Satellite Uplink at the start of the game.
Players[] — Main interface to Players API and an array of all players in the game, including Scavengers.
Players.alliesAndMe[] — Returns an array of players objects for living allied players, including me.
Players.alive[] — Returns an array of players objects for living players.
Players.allies[] — Returns an array of players objects for living allied players.