Epoch/Sources/epoch_code/compile/functions/EPOCH_pushCustomVar.sqf
vbawol 1a211407b9 updates to login system and hitpoints
- No longer track hitpoints from client side, now saved server side only
and pushed to clients on login.
https://community.bistudio.com/wiki/getAllHitPointsDamage
- Changed use set / getUnitLoadout and should still have legacy player
data support that will upgrade automatically on first save.
- Default loadout can be controlled via new variables in epochconfig.hpp
- Made data validation check dynamic using isEqualTypeParams as it does
type checking and still fails if input is shorter than the default.
https://community.bistudio.com/wiki/isEqualTypeParams
- Added back server side damage protection for the new player body. If
the new unit dies before the player switch it could cause login issues
and should not cause issues with scripted setdamage or hitpoints as
first thought. https://community.bistudio.com/wiki/allowDamage
2017-08-15 14:19:03 -05:00

37 lines
1.1 KiB
Plaintext

/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Sends message server to save custom variables from player
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/functions/EPOCH_pushCustomVar.sqf
Example:
true call EPOCH_pushCustomVar;
Parameter(s):
_this: BOOL - true = fast save, false = slow save window
Returns:
NOTHING
*/
//[[[cog import generate_private_arrays ]]]
private ["_customVars","_lastSave","_time"];
//[[[end]]]
_time = if (_this) then [{15},{80}];
_lastSave = missionNamespace getVariable["EPOCH_lastSave", diag_tickTime];
if ((diag_tickTime - _lastSave) >= _time) then {
_customVars = [];
{
_customVars pushBack (missionNamespace getVariable format["EPOCH_player%1",_x]);
} forEach (missionNamespace getVariable["EPOCH_customVars", []]);
[player,_customVars,missionNamespace getVariable "Epoch_personalToken"] remoteExec ["EPOCH_fnc_savePlayer",2];
missionNamespace setVariable["EPOCH_lastSave", diag_tickTime];
};