SetPlrExtraData

Category: Player
Since engine version: 4.9.1.0 GWE

Description

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.

Syntax

any SetPlrExtraData (int iPlr, string strDataName, any Data);

Parameters

iPlr:
Player for whom additional data is saved
strDataName:
Name for the data
Data:
Data to be saved.

Remarks

No objects or strings 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.

Example

Timer:
  for(var i=0; i<GetPlayerCount(); i++)
    SetPlrExtraData(i, "MySzen_Wealth", GetWealth(i));
  return();

Initialize:
  for(var i=0; i<GetPlayerCount(); i++)
    SetWealth(i, GetPlrExtraData(i, "MySzen_Wealth"));
  return();
  
The first function periodically saves the wealth with the name "MySzen_Wealth" in the player's file. If the round is restarted, the wealth is restored in Initialize.
See also: GetPlrExtraData, SetCrewExtraData
PeterW, Januar 2002