# SetPlrExtraData

Player
5.1 OC5.2 OC
any
int player Player for whom additional data is saved.
string data_name Name for the data.
any Data Data to be saved.
With this function additional data can be saved in player's file. This can be used to preserve values across scenarios, for example for RPGs or highscores. If successful, the saved value is returned.
No objects or arrays may be saved.
Because all scenarios use the same storage, the name for the data should be prefixed with the scenario name or your developer id.
func SaveWealth() { for(var i=0; i<GetPlayerCount(); i++) SetPlrExtraData(i, "MySzen_Wealth", GetWealth(i)); }

func Initialize() { for(var i=0; i<GetPlayerCount(); i++) SetWealth(i, GetPlrExtraData(i, "MySzen_Wealth")); }
The first function saves the wealth with the name "MySzen_Wealth" into the player's file. It should be called on periodically or on the end of the round. If the round is restarted, the wealth is restored in Initialize.
GetPlrExtraData
SetCrewExtraData
PeterW
2002-01