server/addons/db/functions/fnc_saveToStore.sqf
Jacob Schmidt bec0adcdbf feat: Update build environment and add XEH PREP
This commit includes the following changes:

-   Updates the build environment in the GitHub Actions workflow to use `ubuntu-latest` instead of `ubuntu-22.04`.
-   Adds `playerGroup2Server` to the XEH_PREP.hpp file.
-   Updates the picture path in CfgMods.hpp to include the file extension.
2025-03-28 09:46:08 -05:00

44 lines
1.1 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Function: forge_server_db_fnc_saveToStore
* Author: J. Schmidt
*
* Description:
* Saves data to a store in the specified namespace
*
* Arguments:
* 0: _name - Store name <STRING>
* 1: _data - Data to save <HASHMAP, ARRAY, ANY>
* 2: _key - Key to save under <STRING>
* 3: _namespace - Namespace to use (Optional, default: missionNamespace) <NAMESPACE>
*
* Return Value:
* Success <BOOL>
*/
params [
["_name", "", [""]],
["_data", nil, [createHashMap, [], "", 0, true]],
["_key", "", [""]],
["_namespace", missionNamespace, [missionNamespace]]
];
if (_name isEqualTo "" || _key isEqualTo "") exitWith {
ERROR_MSG_2("Invalid store name or key: %1, %2", _name, _key);
false
};
private _stores = _namespace getVariable [QGVAR(stores), createHashMap];
private _store = _stores getOrDefault [_name, createHashMap];
_store set [_key, _data];
_stores set [_name, _store];
_namespace setVariable [QGVAR(stores), _stores];
switch (_namespace) do {
case (missionNamespace): { saveMissionProfileNamespace; };
case (profileNamespace): { saveProfileNamespace; };
};
true