Forum Jump :

Author Message

Posts: 7

Level: Member

Country: us
Age: 43
In-game name:

#184543 Posted at 2015-12-15 06:29        
Okay so I removed this code below from my LootBox search script.

uisleep 900;
deleteVehicle _Object;

This has made the LootBox spawn and stay even if the client disconnects. Then I made the script below on the server to cleanup the spawned LootBox.
	if (isServer) then {
		[] spawn {
			while {true} do {
				diag_log format ["[Purge Check]: at %1", time];
				_Objects1 = (allMissionObjects "LootBox");
				_Objects2 = (allMissionObjects "Camp_Fire");
				_ObjectsTotal = _Objects1 + _Objects2;

					_nearby = {isPlayer _x} count (_x nearEntities [["CAManBase"], 300]);
					if (_nearby == 0) then {
						diag_log format ["[Purge]: Deleting %1", _x];
						deleteVehicle _x;
				} forEach _ObjectsTotal;
			uiSleep 900;
All of this is working but it removes all LootBoxes every 15 mins even if a LootBox is less than 5 mins old. Now I need to learn how to make it only remove Lootboxes that are > 15 mins from the time they are spawned. *YAHOO*