
All checks were successful
Build / Build (push) Successful in 28s
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.
38 lines
1.2 KiB
Plaintext
38 lines
1.2 KiB
Plaintext
#include "..\script_component.hpp"
|
|
|
|
/*
|
|
* Author: IDSolutions
|
|
* Adds or removes funds from an organization's account
|
|
*
|
|
* Arguments:
|
|
* 0: Amount <NUMBER> - Amount to add (positive) or withdraw (negative)
|
|
*
|
|
* Return Value:
|
|
* Success <BOOLEAN> - True if funds were updated successfully, false otherwise
|
|
*
|
|
* Example:
|
|
* [1000] call forge_client_org_fnc_addFunds // Add 1000 funds
|
|
* [-500] call forge_client_org_fnc_addFunds // Remove 500 funds
|
|
*
|
|
* Public: Yes
|
|
*/
|
|
|
|
params [["_amount", 0, [0]]];
|
|
|
|
// Get the organization store interface
|
|
private _store = call FUNC(verifyOrgStore);
|
|
|
|
// Update the organization's funds
|
|
private _result = _store call ["updateFunds", [_amount]];
|
|
|
|
// Provide feedback based on success or failure
|
|
if (_result) then {
|
|
private _actionText = ["removed from", "added to"] select (_amount > 0);
|
|
private _absAmount = abs _amount call EFUNC(misc,formatNumber);
|
|
[format ["$%1 %2 organization funds", _absAmount, _actionText], "info", 5, "right"] call forge_client_misc_fnc_notify;
|
|
} else {
|
|
["Failed to update organization funds", "error", 5, "right"] call forge_client_misc_fnc_notify;
|
|
};
|
|
|
|
// Return the result for further operations
|
|
_result |