#include "..\script_component.hpp"

/*
 * Function: forge_client_init_fnc_playerSaveLoop
 * Author: IDSolutions
 *
 * [Description]
 * Initialize player save loop.
 *
 * Arguments:
 * N/A
 *
 * Return Value:
 * N/A
 *
 * Examples:
 * [] call forge_client_init_fnc_playerSaveLoop (Server or Singleplayer Only)
 * [] remoteExecCall ["forge_client_init_fnc_playerSaveLoop", 2, false] (Multiplayer Only)
 *
 * Public: Yes
 */

waitUntil { !isNull player };
waitUntil { alive player };

while { true } do {
    sleep ((configFile >> "CfgPatches" >> "forge_client_main" >> "clientSaveLoopTime") call BFUNC(getCfgData));

	["Saving player...", "blue-grey", 3] call EFUNC(misc,notify);
    call FUNC(playerDBSave);
};