Epoch/Sources/epoch_code/compile/setup/EPOCH_clientRevive.sqf

79 lines
2.3 KiB
Plaintext
Raw Normal View History

2015-12-07 16:24:52 +00:00
/*
Author: Aaron Clark - EpochMod.com
Contributors:
Description:
Unisex check for vests, gives swing ammo and performs radio changed check
Licence:
Arma Public License Share Alike (APL-SA) - https://www.bistudio.com/community/licenses/arma-public-license-share-alike
Github:
2016-06-13 16:54:19 +00:00
https://github.com/EpochModTeam/Epoch/tree/release/Sources/epoch_code/compile/setup/EPOCH_clientRevive.sqf
2015-12-07 16:24:52 +00:00
Example:
_data call EPOCH_clientRevive;
Parameter(s):
_this select 0: OBJECT - player object
_this select 1: STRING - personal token
_this select 2: NUMBER - loadABS
2015-12-07 16:24:52 +00:00
Returns:
NOTHING
*/
2016-09-01 00:29:08 +00:00
//[[[cog import generate_private_arrays ]]]
private ["_prevPlayerObject"];
2016-09-01 00:29:08 +00:00
//[[[end]]]
params [
["_playerObject",objNull,[objNull]],
["_personalToken","",[""]],
["_loadAbs",0,[0]]
];
if (isNull _playerObject) exitWith { diag_log "EPOCH-DEBUG: New Player Object was Null cannot revive." };
2015-09-14 20:55:36 +00:00
if !(alive player && alive _playerObject && !isPlayer _playerObject) then {
// reveal new player object (to hopefully propigate info faster).
player reveal _playerObject;
2015-09-14 20:55:36 +00:00
// spawn a thread to wait for loadAbs to sync before using selectPlayer
[_playerObject,_personalToken,_loadAbs] spawn {
params ["_playerObject","_personalToken","_loadAbs"];
2015-09-14 20:55:36 +00:00
// get current player object
_prevPlayerObjectect = player;
2015-09-14 20:55:36 +00:00
// wait for loadAbs to sync
2016-01-08 23:19:18 +00:00
// switch to new playerObject
selectPlayer _playerObject;
// delete previous player object
deleteVehicle _prevPlayerObject;
// set token and can revive to false
Epoch_canBeRevived = false;
Epoch_personalToken = _personalToken;
// restart masterloop
[] spawn EPOCH_masterLoop;
[5, 100] call EPOCH_niteLight;
closeDialog 0;
("BIS_fnc_respawnCounter" call BIS_fnc_rscLayer) cutText ["","PLAIN"];
{
player removeEventHandler [_x, 0];
player addEventHandler [_x,(["CfgEpochClient", _x, ""] call EPOCH_fnc_returnConfigEntryV2)];
} forEach (["CfgEpochClient", "addEventHandler", []] call EPOCH_fnc_returnConfigEntryV2);
// reset blood Pressure to warning level
EPOCH_playerBloodP = 120;
};
2015-09-14 20:55:36 +00:00
} else {
deleteVehicle _playerObject;
};
2015-10-28 15:16:00 +00:00
true call EPOCH_pushCustomVar;