client/addons/money/functions/fnc_giveCashSubmit.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

39 lines
1.1 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Handle cash to be given
*
* Arguments:
* 0: Target to add money <OBJECT>
* 1: Player to remove money <OBJECT>
*
* Return Value:
* N/A
*
* Examples:
* [cursorObject, player] spawn forge_client_money_fnc_giveCashSubmit;
*
* Public: Yes
*/
params ["_target", "_player"];
private _amount = parseNumber (ctrlText 1401);
private _playerCash = GETVAR(player,FORGE_Cash,0);
private _targetCash = GETVAR(_target,FORGE_Cash,0);
if (_amount > 0) then {
if (_amount > _playerCash) exitWith { ["Insufficient cash available.", "warning", 3] call EFUNC(misc,notify) };
private _newCash = _targetCash + _amount;
private _formattedAmount = (_amount) call EFUNC(misc,formatNumber);
SETPVAR(_target,FORGE_Cash,_newCash);
["deduct", "Cash", _amount] remoteExecCall ["forge_server_money_fnc_handleMoney", 2];
[format ["You have received $%2 cash from %1", _player, _formattedAmount], "blue-grey", 3] remoteExecCall [QEFUNC(misc,notify), _target];
} else {
[format ["Enter a valid amount greater than zero."], "warning", 3] call EFUNC(misc,notify);
};
closeDialog 0;