Forum Jump :

Author Message

Posts: 7

Level: Member

Country: us
Age: 43
In-game name:

#184430 Posted at 2015-12-10 04:10        
I have a script so that when the player's cursor is on some objects the player can "Search" for loot. The script works great as it creates the LootBox and removes it 15 mins later. The issue I'm having is that this is a MP server and if the player that does the Search logs off before the 15 mins is up the LootBox will not be removed. I know this is because I have the uisleep 900, but I was wondering if there is a way to make the script finish when the time is up even if the user has logged off. Any help with this will be greatly appreciated.

private ["_playerPos","_nearobjects","_Object"];

call gear_ui_init;

_playerPos = getPosATL player;
_nearobjects = count nearestObjects [_playerPos, ["LootBox"], 10] > 0;

if (vehicle player == player) then {
if (!_nearobjects ) then {
disableUserInput true;
player playActionNow "PutDown";
taskhint ["Now searching the area for loot.", [0, 1, 0, 1], "taskDone"];
uisleep 1;
_Object = createVehicle ["LootBox", (player modelToWorld [0,1,0]),[], 0, "CAN_COLLIDE"];
_Object setVehiclePosition [(player modelToWorld [0,0.5,0.1]), [], 0, "CAN_COLLIDE"];
[_Object,"XMMSAmmoL3"] call LootBox_Fill;
uisleep 1;
disableUserInput false;
disableUserInput true;
disableUserInput false;
uisleep 900;
deleteVehicle _Object;
taskhint ["A search has already been executed in this area.", [1, 0, 0, 1], "taskFailed"];
taskhint ["You are unable to search while you are in a vehicle.", [1, 0, 0, 1], "taskFailed"];