Ok I have it working, though for some reason it overwrites peoples stuff if someone saves it. Then another person saves it later, the person who saved it first, is no longer in the array :/
Any ideas??
saveStats.sqf
_name = _this select 0;
{
s_stats = [];
if (_x select 0 != _name) then
{
s_stats = s_stats + [_x];
};
server_stats_array = s_stats;
publicVariable "server_stats_array";
} foreach server_stats_array;
server_stats_array = server_stats_array + [[_name, DCV_Bank, vehicle_array]];
publicVariable "server_stats_array";
player groupChat format ["%1", server_stats_array];
player groupChat "Stats Saved.";
loadStats.sqf
_name = _this select 0;
if (DCV_loaded_stats == 0) then
{
for [{_i=0},{_i < count server_stats_array}, {_i=_i+1}] do
{
_theName = ((server_stats_array select _i) select 0);
if (_theName == _name) then
{
_myBank = ((server_stats_array select _i) select 1);
_myVehicles = ((server_stats_array select _i) select 2);
DCV_Bank = _myBank;
vehicle_array = _myVehicles;
DCV_loaded_stats = 1;
};
};
/*
{
_x addAction ["Lock\Unlock", "lock.sqf"];
} foreach vehicle_array;
*/
}
else
{
player groupChat "You already retrieved your stats.";
};