client/addons/org/functions/fnc_create.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

50 lines
1.7 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: IDSolutions
* Creates a new organization for a player
*
* Arguments:
* 0: Owner UID <STRING> - Player UID who will own the organization
* 1: Organization Name <STRING> - Name of the organization
* 2: Initial Funds <NUMBER> (Optional, default: 0) - Starting funds for the organization
* 3: Initial Reputation <NUMBER> (Optional, default: 0) - Starting reputation for the organization
*
* Return Value:
* Organization Data <HASHMAP> - The newly created organization data, or nil if creation failed
*
* Example:
* [getPlayerUID player, "Alpha Squad", 5000, 100] call forge_client_org_fnc_create
* [getPlayerUID player, "Bravo Team"] call forge_client_org_fnc_create // With default funds and reputation
*
* Public: Yes
*/
params [
["_ownerUID", "", [""]],
["_name", "", [""]],
["_initialFunds", 0, [0]],
["_initialReputation", 0, [0]]
];
// Validate input parameters
if (_ownerUID == "" || _name == "") exitWith {
["Invalid parameters for organization creation", "error", 5, "right"] call forge_client_misc_fnc_notify;
nil
};
// Get the organization store interface
private _store = call FUNC(verifyOrgStore);
// Create the organization with the provided parameters
private _orgData = _store call ["createOrg", [_ownerUID, _name, _initialFunds, _initialReputation]];
// Provide feedback based on success or failure
if (isNil "_orgData") then {
[format ["Failed to create organization '%1'", _name], "error", 5, "right"] call forge_client_misc_fnc_notify;
} else {
[format ["Organization '%1' created successfully", _name], "success", 5, "right"] call forge_client_misc_fnc_notify;
};
// Return the organization data for further operations
_orgData