Skip to content

Instantly share code, notes, and snippets.

@wiking-at
Created August 29, 2014 15:35
Show Gist options
  • Save wiking-at/95c38d58ccac7aa90b00 to your computer and use it in GitHub Desktop.
Save wiking-at/95c38d58ccac7aa90b00 to your computer and use it in GitHub Desktop.
Fix the Account load for two instances of Bankmoney
// @file Version: 1.0
// @file Name: s_loadAccount.sqf
// @file Author: AgentRev
// @file Created: 25/02/2014 22:21
if (!isServer) exitWith {};
private ["_UID", "_data", "_saveValid", "_getValue"];
_UID = _this;
_data = [];
_saveValid = ([_UID call PDB_playerFileName, "PlayerSave", "Position", "STRING"] call iniDB_read != "");
_data pushBack ["PlayerSaveValid", _saveValid];
_getValue =
{
private ["_name", "_type", "_section", "_value"];
_name = _this select 0;
_type = _this select 1;
_section = [_this, 2, "PlayerSave"] call BIS_fnc_param;
_value = [_UID call PDB_playerFileName, _section, _name, _type] call iniDB_read;
if (!isNil "_value") then
{
_data pushBack [_name, _value];
};
};
//first load old value
["Donator", "NUMBER", "PlayerInfo"] call _getValue;
//now try to load money from the new,persistant value
["BankMoney", "NUMBER", "PlayerInfo"] call _getValue; // Not implemented in vanilla mission
["Damage", "NUMBER"] call _getValue;
["Hunger", "NUMBER"] call _getValue;
["Thirst", "NUMBER"] call _getValue;
if (["A3W_moneySaving"] call isConfigOn) then
{
["Money", "NUMBER"] call _getValue;
};
["LoadedMagazines", "ARRAY"] call _getValue;
["PrimaryWeapon", "STRING"] call _getValue;
["SecondaryWeapon", "STRING"] call _getValue;
["HandgunWeapon", "STRING"] call _getValue;
["PrimaryWeaponItems", "ARRAY"] call _getValue;
["SecondaryWeaponItems", "ARRAY"] call _getValue;
["HandgunItems", "ARRAY"] call _getValue;
["AssignedItems", "ARRAY"] call _getValue;
["CurrentMuzzle", "STRING"] call _getValue;
["Stance", "STRING"] call _getValue;
["Uniform", "STRING"] call _getValue;
["Vest", "STRING"] call _getValue;
["Backpack", "STRING"] call _getValue;
["Goggles", "STRING"] call _getValue;
["Headgear", "STRING"] call _getValue;
["UniformWeapons", "ARRAY"] call _getValue;
["UniformItems", "ARRAY"] call _getValue;
["UniformMagazines", "ARRAY"] call _getValue;
["VestWeapons", "ARRAY"] call _getValue;
["VestItems", "ARRAY"] call _getValue;
["VestMagazines", "ARRAY"] call _getValue;
["BackpackWeapons", "ARRAY"] call _getValue;
["BackpackItems", "ARRAY"] call _getValue;
["BackpackMagazines", "ARRAY"] call _getValue;
["PartialMagazines", "ARRAY"] call _getValue;
["WastelandItems", "ARRAY"] call _getValue;
["Position", "ARRAY"] call _getValue;
["Direction", "NUMBER"] call _getValue;
// If Bankmoney can't be loaded from Playerinfo - look if there is a value in Playersave and add it to array
//even if the Line 25 if (!isNil "_value") is checking and there is no BankMoney in PlayerInfo a ["BankMoney",0] will be pushed to the array.
if (["BankMoney",0] in _data) then
{
["BankMoney", "NUMBER", "PlayerSave"] call _getValue;
};
//diag_log _data;
_data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment