client/addons/db/functions/fnc_requestServerDB.sqf
Jacob Schmidt d474b3676a
All checks were successful
Build / Build (push) Successful in 28s
Refactor: Standardize function descriptions and variable handling
This commit refactors several client-side functions to improve code consistency and readability.

- Standardizes function descriptions by removing redundant "Function: forge_client..." prefixes and "[Description]" sections, focusing on concise descriptions of the function's purpose.
- Updates variable handling in arsenal functions to use GVAR and EGVARS for default values, improving consistency and reducing code duplication.
- Removes the bank init function as it is no longer needed.
- Adds a done variable to the preinit file.
2025-05-25 11:30:26 -05:00

37 lines
935 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Sends database requests to the server using CBA events
*
* Arguments:
* 0: _type - Type of database operation <STRING>
* 1: _data - Data for the operation <ANY>
* 2: _callback - Function to call when data is returned <CODE>
*
* Return Value:
* Request ID <STRING>
*
* Example:
* ["hgetall", "Hello World!", { systemChat format ["Message: %1", _this]; }] call forge_db_fnc_requestServerDB;
*
* Public: Yes
*/
params [
["_type", "", [""]],
["_data", nil, [createHashMap, [], "", 0, true, objNull]],
["_callback", {}, [{}]]
];
private _requestID = format ["%1_%2", diag_tickTime, random 1000];
if (isNil QGVAR(pendingCallbacks)) then {
GVAR(pendingCallbacks) = createHashMap;
};
GVAR(pendingCallbacks) set [_requestID, _callback];
["forge_db_request", [getPlayerUID player, _type, _data, _requestID]] call CBA_fnc_serverEvent;
_requestID