|
1 | | -#include "\life_server\script_macros.hpp" |
2 | | -/* |
3 | | - File: fn_clientDisconnect.sqf |
4 | | - Author: Bryan "Tonic" Boardwine |
5 | | -
|
6 | | - Description: |
7 | | - When a client disconnects this will remove their corpse and |
8 | | - clean up their storage boxes in their house. Also, saves player infos & position. |
9 | | -*/ |
10 | | -params [ |
11 | | - ["_unit",objNull,[objNull]], |
12 | | - "", |
13 | | - ["_uid","",[""]] |
14 | | -]; |
15 | | -if (isNull _unit) exitWith {}; |
16 | | - |
17 | | -//Save civilian position |
18 | | -if (life_save_civilian_position && {side _unit isEqualTo civilian}) then { |
19 | | - if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then { |
20 | | - if ((getMarkerPos "respawn_civilian" distance _position) > 300) then { |
21 | | - if (life_HC_isActive) then {[_unit,4] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_unit,4] spawn DB_fnc_updatePartial}; |
22 | | - }; |
23 | | - }; |
24 | | -}; |
25 | | - |
26 | | -if !(alive _unit) then { |
27 | | - diag_log format["%1 disconnected while dead.",_uid]; |
28 | | -} else { |
29 | | - { |
30 | | - _x params [ |
31 | | - ["_corpseUID","",[""]], |
32 | | - ["_corpse",objNull,[objNull]] |
33 | | - ]; |
34 | | - if (_corpseUID isEqualTo _uid) exitWith { |
35 | | - if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex}; |
36 | | - [_corpse] remoteExecCall ["life_fnc_corpse",0]; |
37 | | - diag_log format["%1 disconnected while dead.",_corpseUID]; |
38 | | - server_corpses deleteAt _forEachIndex; |
39 | | - }; |
40 | | - } forEach server_corpses; |
41 | | -}; |
42 | | - |
43 | | -private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5]; |
44 | | -{deleteVehicle _x} forEach _containers; |
45 | | -deleteVehicle _unit; |
46 | | - |
47 | | -[_uid] spawn TON_fnc_houseCleanup; |
| 1 | +#include "\life_server\script_macros.hpp" |
| 2 | +/* |
| 3 | + File: fn_clientDisconnect.sqf |
| 4 | + Author: Bryan "Tonic" Boardwine |
| 5 | +
|
| 6 | + Description: |
| 7 | + When a client disconnects this will remove their corpse and |
| 8 | + clean up their storage boxes in their house. Also, saves player infos & position. |
| 9 | +*/ |
| 10 | +params [ |
| 11 | + ["_unit",objNull,[objNull]], |
| 12 | + "", |
| 13 | + ["_uid","",[""]] |
| 14 | +]; |
| 15 | +if (isNull _unit) exitWith {}; |
| 16 | + |
| 17 | +//Save civilian position |
| 18 | +if (life_save_civilian_position && {side _unit isEqualTo civilian}) then { |
| 19 | + if (isNil "HC_UID" || {!(_uid isEqualTo HC_UID)}) then { |
| 20 | + if (life_HC_isActive) then {[_unit,4] remoteExec ["HC_fnc_updatePartial",HC_Life]} else {[_unit,4] spawn DB_fnc_updatePartial}; |
| 21 | + }; |
| 22 | +}; |
| 23 | + |
| 24 | +if !(alive _unit) then { |
| 25 | + diag_log format["%1 disconnected while dead.",_uid]; |
| 26 | +} else { |
| 27 | + { |
| 28 | + _x params [ |
| 29 | + ["_corpseUID","",[""]], |
| 30 | + ["_corpse",objNull,[objNull]] |
| 31 | + ]; |
| 32 | + if (_corpseUID isEqualTo _uid) exitWith { |
| 33 | + if (isNull _corpse) exitWith {server_corpses deleteAt _forEachIndex}; |
| 34 | + [_corpse] remoteExecCall ["life_fnc_corpse",0]; |
| 35 | + diag_log format["%1 disconnected while dead.",_corpseUID]; |
| 36 | + server_corpses deleteAt _forEachIndex; |
| 37 | + }; |
| 38 | + } forEach server_corpses; |
| 39 | +}; |
| 40 | + |
| 41 | +private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5]; |
| 42 | +{deleteVehicle _x} forEach _containers; |
| 43 | +deleteVehicle _unit; |
| 44 | + |
| 45 | +[_uid] spawn TON_fnc_houseCleanup; |
0 commit comments