private ["_center","_group","_pos","_gameLogic","_player","_objBus","_isBus","_nrPlayer","_range","_busVar","_beepHorn","_axBusDriver","_beepCount","_busObj"];
_array = _this select 3;
_player = _array select 1;
_range = 25;
_beepCount = 0;
_center = createCenter sideLogic;
_group = createGroup _center;
_pos = [0, 0, 0];
_gameLogic = _group createUnit ["LOGIC",_pos , [], 0, ""];
//_beepHorn = compile loadFile "busroute\beep_horn.sqf";
while {true}
do
{
if (!isNull player) then
{
_nrPlayer = vehicle player;
_objBus = nearestObjects [_nrPlayer, ["Ikarus_TK_CIV_EP1"], _range];
if(count _objBus >0)then{
{
if(str(_x getVariable ["axBusGroup","NONE"]) != "NONE")then{
hint format ["Bus Found: Vel:%1",velocity _x];
sleep .5;
_isBus=true;
//[_nrPlayer,_objBus] call _beepHorn;
_axBusDriver = driver _x;
//Beep Horn
if(_nrPlayer distance _x >10 && _beepCount < 3)then{
_gameLogic action ["useWeapon",_x,_axBusDriver,0];
_gameLogic action ["useWeapon",_x,_axBusDriver,1];
_gameLogic action ["useWeapon",_x,_axBusDriver,2];
_beepCount=_beepCount+1;
hint format["Beeping Horn:Count:%1",_beepCount];
sleep .5;
//Try to Flash Lights (Not yet tested at night). Needs time detection or just night time flashing ?
_axBusDriver action ["LightOn",_x];
sleep .3;
_axBusDriver action ["LightOff",_x];
_busObj = _x;
};
};
}forEach _objBus;
}else{
_beepCount=0;
_player=objNull;
_isBus = false;
player removeAction axeHailBus;
};
if (_player != player && _isBus) then
{
_player = player;
axeHailBus = player addAction ["<t color=""#ffff33"">" + ("Hail Bus") + "</t>", "busroute\hail_bus.sqf",[_busObj,_gameLogic],-19,false];
};
};
};