-
Notifications
You must be signed in to change notification settings - Fork 46
/
onPlayerRespawn.sqf
71 lines (62 loc) · 2.14 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
62
63
64
65
66
67
68
69
70
71
waitUntil {!isNil "bulwarkBox"};
["Terminate"] call BIS_fnc_EGSpectator;
player setVariable ["buildItemHeld", false];
//Make player immune to fall damage / immune to all damage while incapacitated / immune with a medikit
player addEventHandler ["HandleDamage", {
_beingRevived = player getVariable "RevByMedikit";
TEAM_DAMAGE = missionNamespace getVariable "TEAM_DAMAGE";
_incDamage = _this select 2;
_playerItems = items player;
_players = allPlayers;
if ((_this select 4) == "" || lifeState player == "INCAPACITATED" || _beingRevived || ((_this select 3) in _players && !TEAM_DAMAGE && !((_this select 3) isEqualTo player))) then {
0
} else {
if (_incDamage >= 0.9) then {
_playerItems = items player;
if ("Medikit" in _playerItems) then {
player removeItem "Medikit";
player setVariable ["RevByMedikit", true, true];
player playActionNow "agonyStart";
player playAction "agonyStop";
player setDamage 0;
[player] remoteExec ["bulwark_fnc_revivePlayer", 2];
0;
};
} else {
_this call bis_fnc_reviveEhHandleDamage;
};
};
}];
//delete empty continers
[player, ['Take', {
params ['_unit', '_container', '_item'];
[_container] remoteExecCall ["loot_fnc_deleteIfEmpty", 2];
}]] remoteExec ['addEventHandler', 0, true];
_player = _this select 0;
removeHeadgear _player;
removeGoggles _player;
removeVest _player;
removeBackpack _player;
removeAllWeapons _player;
removeAllAssignedItems _player;
_player setPosASL ([bulwarkBox] call bulwark_fnc_findPlaceAround);
if(PLAYER_STARTWEAPON) then {
_player addMagazine "16Rnd_9x21_Mag";
_player addMagazine "16Rnd_9x21_Mag";
_player addWeapon "hgun_P07_F";
};
if(PLAYER_STARTMAP) then {
_player addItem "ItemMap";
_player assignItem "ItemMap";
_player linkItem "ItemMap";
};
if(PLAYER_STARTNVG) then {
_player addItem "Integrated_NVG_F";
_player assignItem "Integrated_NVG_F";
_player linkItem "Integrated_NVG_F";
};
if (isClass (configfile >> "CfgVehicles" >> "tf_anarc164")) then {
_player addItem "tf_anprc152";
};
waituntil {alive _player};
[] remoteExec ["killPoints_fnc_updateHud", 0];