client/addons/org/functions/fnc_create.sqf
Jacob Schmidt 613f05d52a Refactor: Database and Client Updates
This commit introduces several changes related to database interactions and client-side functionality:

*   **Database Response Handling:** Implements a mechanism to handle responses from server requests, specifically for database operations. This includes setting up a callback system to process results based on request IDs.
*   **Store Functionality:** Corrects a typo in the `fnc_buyItem.sqf` script, changing `EFUNC(armory,addArmoryItem)` to `EFUNC(arsenal,addArmoryItem)`.
*   **Inventory Management:** Improves the `fnc_moveInventory.sqf` script by correcting a conditional statement to ensure proper handling of inventory items.
*   **Configuration Updates:** Updates the mod configuration (`CfgMods.hpp`) to use the correct path for the mod picture.
*   **Client Initialization:** Adds a client registration call to the server during client post-initialization (`XEH_postInit_client.sqf`).
*   **Workflow Update:** Updates the build workflow to use the latest Ubuntu runner.
*   **Database Preparation:** Removes unnecessary preparations from `XEH_postInit.sqf` and `XEH_PREP.hpp`.
2025-03-28 09:46:24 -05:00

43 lines
1.2 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Function: forge_client_org_fnc_create
* Author: J. Schmidt
*
* Description:
* Creates a new organization for a player
*
* Arguments:
* 0: _ownerUID - Player UID <STRING>
* 1: _ownerName - Player name <STRING>
* 2: _name - Organization name <STRING>
*
* Return Value:
* Success <BOOL>
*/
params [["_ownerUID", "", [""]], ["_ownerName", "", [""]], ["_name", "", [""]]];
if (_ownerUID == "" || _ownerName == "" || _name == "") exitWith { TRACE_3("Invalid parameters for organization creation",_ownerUID,_ownerName,_name); false };
private _store = call FUNC(verifyOrgStore);
private _key = format ["%1_%2", _ownerUID, _name];
private _existingOrg = _store call ["getByKey", [_key]];
private _playerAlreadyInOrg = false;
{
private _org = _x;
private _members = _org get "members";
if (!isNil { _members get _ownerUID }) exitWith {
_playerAlreadyInOrg = true;
};
} forEach (_store call ["get", []]);
if (_playerAlreadyInOrg) exitWith { TRACE_1("Player already in an organization",_ownerUID); false };
_store call ["post", [_ownerUID, _name, 0, 0]];
[_name, _ownerUID, _ownerName, "owner"] call FUNC(join);
TRACE_2("Organization created successfully",_name,_ownerUID);
true