summaryrefslogtreecommitdiffstats
path: root/Server/Functions/Server_TrashObject.sqf
blob: bb983f13113a1a65b4f4acb13fcb6b45ddf06f80 (plain)
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
/* 
	Author: Benny
	Name: Server_TrashObject.sqf
	Parameters:
	  0 - Object
	Description:
	  This function will remove an object after the defined amount of time.
*/

private ["_alive","_group","_isMan","_object","_get"];
_object = _this;

if !(isNull _object) then {
	_group = [];
	_isMan = if (_object isKindOf "Man") then {true} else {false};
	
	if (_isMan) then {_group = group _object};
	
	sleep ('WFBE_UNITREMOVEDLAY' Call GetNamespace);
	trashQueu = trashQueu - [_object];
	
	if (_isMan) then {hideBody _object; sleep 6};
	
	deleteVehicle _object;
	
	if (_isMan) then {
		if !(isNull _group) then {
			_get = _group getVariable 'queue';
			if (isNil '_get') then {
				if (count (units _group) <= 0) then {deleteGroup _group;};
			};
		};
	};
};