Versions Compared
compared with
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Excerpt |
---|
Rebuilds all Players Objects. |
Syntax
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Players.refresh(); // rebuild all the players objects |
Parameters
There are no parameters.
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.
- Custom extensions will need to accommodate this scenario (eg. they might need to clear down internal caches) – if they don't strange things could happen.
The only time this should be used is during an eventStartLevel() that immediately follows 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
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Players.refresh(); // are you really sure you want to do this? |
Div | ||||||
---|---|---|---|---|---|---|
| ||||||
Availability
Requires:
|
Div | ||||
---|---|---|---|---|
| ||||
ContentsJump to:
|
Div | ||
---|---|---|
| ||
See alsoRelated articles:
|
Div | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||
Players APITopics:
|