Sarge-AI/ModName.MapName/scripts/UPSMON/COMMON/vehicles/fnc/UPSMON_avoidDissembark.sqf
Teh Dango 65e4453908 2.4.0
Major Update. Now supporting DesolationRedux, Epoch and Exile.
2017-12-31 03:16:37 -05:00

31 lines
794 B
Plaintext

/****************************************************************
File: UPSMON_avoidDissembark.sqf
Author: MONSADA
Description:
If every on is outside, make sure driver can move
Parameter(s):
<--- leader
Returns:
Nothing
****************************************************************/
private["_npc","_vehicle","_timeout"];
_npc = _this select 0;
_vehicle = vehicle _npc;
_timeout = 120;
_timeout = time + _timeout;
while {_npc == vehicle _npc && alive _npc && canmove _npc && time < _timeout} do {
sleep 1;
};
if (!alive _npc || !canmove _npc || time >= _timeout || driver vehicle _npc == _npc) exitwith{};
_npc stop true;
while {_npc != vehicle _npc && alive _npc && canmove _npc} do {sleep 1;};
_npc stop false;
sleep 0.5;
if (!alive _npc || !canmove _npc) exitwith{};