-
Notifications
You must be signed in to change notification settings - Fork 0
/
onPlayerRespawn.sqf
61 lines (50 loc) · 1.93 KB
/
onPlayerRespawn.sqf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*********************************************************************************
_____ ____ _____
| _ | \| __|
| | | | __|
|__|__|____/|__|
ARMA Mission Development Framework
ADF version: 2.26 / Jul 2020
Script: mission events
Author: Whiztler
Script version: 1.03
File: onPlayerRespawn.sqf
**********************************************************************************
PARAMETERS
_newUnit Object - respawned player
_oldUnit Object - player corpse
RETURNS:
an alive player
*********************************************************************************/
params [
"_newUnit",
"_oldUnit"
];
diag_log format ["ADF rpt: respawning client: %1 (old unit: %2)", _newUnit, _oldUnit];
private _timeOut = time + 30;
waitUntil {
diag_log format ["« C O I N » onPlayerRespawn.sqf - Unit %1 respawning. Waiting for player to initialize (%2)...", _newUnit, isPlayer _newUnit];
sleep 1;
isPlayer _newUnit || time > _timeOut
};
if (isNil "_newUnit" || time > _timeOut) exitWith {diag_log format ["« C O I N » onPlayerRespawn.sqf - Unit %1 does not exist or did not initialize. Terminating ADF_mission_playerRespawn.", _newUnit];};
if (
(_oldUnit getVariable ["COIN_isLeadership", false]) ||
{(_newUnit getVariable ["COIN_isLeadership", false]) ||
{(COIN_leadership == _oldUnit) ||
{(COIN_leadership == _newUnit) ||
{(COIN_leadership == player)}}}}
) then {
diag_log "« C O I N » onPlayerRespawn.sqf - Player is COIN_leadership";
COIN_leadership = player;
publicVariableServer "COIN_leadership";
player setVariable ["COIN_isLeadership", true, 2];
call COIN_fnc_assignViper;
call COIN_fnc_assignKnight;
call COIN_fnc_assignTomcat;
call COIN_fnc_assignClipper;
call COIN_fnc_assignSidesMissionSkip;
diag_log "« C O I N » onPlayerRespawn.sqf - Support command re-assigned";
};
setUnitLoadout COIN_loadout;
diag_log format ["« C O I N » onPlayerRespawn.sqf - Player (%1) has respawned.", _newUnit];