server/addons/save/functions/fnc_handleDisconnect.sqf
Jacob Schmidt eec98d03eb
All checks were successful
Build / Build (push) Successful in 25s
feat: Implement admin event handling and improve player data saving
This commit introduces admin event handling to manage various administrative actions and enhances the player data saving process.

The following changes were made:

-   Implemented event handling for admin actions such as advancing funds, handling paydays, transferring funds, sending messages, and updating paygrades. These events are triggered via the `QGVAR(handleEvents)` event handler.
-   Added `initAdminStore` and `verifyAdminStore` functions to manage the admin store.
-   Refactored the `fnc_handleDisconnect.sqf` script to use the `GETVAR` macro for retrieving player data, ensuring consistency and readability.
-   Replaced hardcoded default values with `QUOTE()` wrapped values in `fnc_handleDisconnect.sqf` for better maintainability and configuration.
2025-05-03 19:33:45 -05:00

59 lines
2.0 KiB
Plaintext

#include "..\script_component.hpp"
/*
@file Title: ArmaDragonflyClient Framework by Creedcoder, J.Schmidt
@file Version: 0.1
@file Name: fnc_savePlayer.sqf
@file Author: Creedcoder, J.Schmidt
@file edit: 03.25.2024
Copyright © 2024 Creedcoder, J.Schmidt, All rights reserved
Do not edit without permission!
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons,
444 Castro Street, Suite 900, Mountain View, California, 94041, USA.
Save Player to DB:
*/
addMissionEventHandler ["HandleDisconnect", {
// params ["_unit", "_id", "_uid", "_name"];
private _unit = _this select 0;
private _uid = _this select 2;
private _default_armory_unlocks = [[],[],[],[]];
private _default_garage_unlocks = [[],[],[],[],[],[]];
private _data = [
_uid,
"armory_unlocks", [GETVAR(_unit,Armory_Unlocks,_default_armory_unlocks)],
"garage_unlocks", [GETVAR(_unit,Garage_Unlocks,_default_garage_unlocks)],
"locker", [GETVAR(_unit,FORGE_Locker,[])],
"garage", [GETVAR(_unit,FORGE_Garage,[])],
"cash", [GETVAR(_unit,FORGE_Cash,0)],
"bank", [GETVAR(_unit,FORGE_Bank,0)],
"number", [GETVAR(_unit,FORGE_Phone_Number,QUOTE(unknown))],
"email", [GETVAR(_unit,FORGE_Email,QUOTE(unknown@spearnet.mil))],
"paygrade", [GETVAR(_unit,FORGE_PayGrade,QUOTE(E1))],
"reputation", [rating _unit],
"loadout", [getUnitLoadout _unit],
"holster", [GETVAR(_unit,FORGE_Holster_Weapon,true)],
"position", [getPosASLVisual _unit],
"direction", [getDirVisual _unit]
];
if (isNull objectParent _unit) then {
_data pushBack "currentWeapon";
_data pushBack [currentMuzzle _unit];
_data pushBack "stance";
_data pushBack [stance _unit];
};
diag_log format ["Saving Player: %1", _data];
// ["hsetidbulk", "", "", -1, _data, "", false] call dragonfly_db_fnc_addTask;
["hsetidbulk", "", "", -1, _data, "", false] remoteExecCall ["dragonfly_db_fnc_addTask", 2, false];
deleteVehicle _unit;
}];