-
Notifications
You must be signed in to change notification settings - Fork 0
/
OnPlayerLeaving.sqf
39 lines (31 loc) · 1.4 KB
/
OnPlayerLeaving.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
//onPlayerLeaving.sqf
//Runs on players
//Called on mission ending and player leaving
//Records player gear, location and wipes tasks
//pvs
private ["_unit", "_tasks", "_location", "_direction", "_playerUniform", "_playerVest", "_playerBackpack", "_playerWeaponsItems", "_playerUniformItems", "_playerVestItems", "_playerBackpackItems", "_playerMapItems", "_playerHelmet", "_playerGlasses", "_onlyLoadout","_uid"];
_unit = _this select 0;
_uid = _this select 1;
[_unit] joinSilent grpNull;
_tasks = _unit call BIS_fnc_tasksUnit;
{
[_x,_unit] spawn BIS_fnc_deleteTask;
}forEach _tasks;
removeAllActions _unit;
_location = getPos _unit;
_direction = getDir _unit;
_playerUniform = uniform _unit;
_playerVest = vest _unit;
_playerBackpack = backpack _unit;
_playerWeaponsItems = weaponsItems _unit;
_playerUniformItems = uniformItems _unit;
_playerVestItems = vestItems _unit;
_playerBackpackItems = backpackItems _unit;
_playerMapItems = assignedItems _unit;
_playerHelmet = headgear _unit;
_playerGlasses = goggles _unit;
_onlyLoadout = true;
SaveGear = [[_unit,_uid],[_playerUniform,_playerVest,_playerBackpack,_playerWeaponsItems,_playerUniformItems,_playerVestItems,_playerBackpackItems,_playerMapItems,_playerHelmet,_playerGlasses],[nil,nil,nil,nil],_onlyLoadout];
publicVariableServer "SaveGear";
SaveLocation = [_unit,_uid,_location,_direction];
publicVariableServer "SaveLocation";