Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this setVariable ["fex_vehicleCounter",false,true];
- this addEventHandler ["GetIn", {
- params ["_vehicle", "_role", "_unit", "_turret"];
- if (count crew _vehicle > 0) then {
- hint format ["Someone entered vehicle %1. Resetting counter", typeOf _vehicle];
- _vehicle setVariable ["fex_vehicleCounter",false,true];
- }
- }];
- this addEventHandler ["GetOut", {
- params ["_vehicle", "_role", "_unit", "_turret"];
- if (count crew _vehicle == 0) then
- {
- hint format ["Vehicle %1 is empty, starting counter", typeOf _vehicle];
- _vehicle setVariable ["fex_vehicleCounter",true,true];
- _0 = _vehicle spawn
- {
- _internalCounter = 30;
- while {_this getVariable "fex_vehicleCounter" && _internalCounter > 0} do
- {
- uiSleep 1;
- _internalCounter = _internalCounter - 1;
- systemChat format ["%1", _internalCounter];
- };
- if (_internalCounter == 0 && count crew _this == 0) then
- {
- hint format ["Vehicle %1 is empty for too long. Destroying vehicle", typeOf _this];
- _this setDamage 1;
- } else
- {
- uiSleep 1;
- hint format ["Counter for vehicle %1 has been stopped by other means", typeOf _this];
- };
- };
- };
- }];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement