Hi guys,
my server AI taxi function need a cool down script to stop call unlimited AI taxi at a very shot time. the AI taxi function perform good but one player can call it unlimited times continuously. here's the init part. SOS assistance PLS.
//--- run this script when the user decides to call a taxi
// EX:
// player addAction ["Call Taxi",{[] spawn LY_fnc_CallTaxi;}];
LY_fnc_CallTaxi = {
_roads = player nearRoads 50;
if(_roads isEqualTo []) exitWith {hint "you must near a road";};
_nearest = objNull;
_dist = 1e4;
{
if(player distance _x < _dist) then {
_nearest = _x;
_dist = player distance _x;
};
} forEach _roads;
_location = getposatl _nearest;
if(openMap true) then {
_location spawn {
_location = _this;
hint "click map spot then it will start.";
Taxi_Target_Location = [];
onMapSingleClick "
_roads = _pos nearRoads 100;
if(count(_roads) > 0) then {
_nearest = objNull;
_dist = 1e4;
{
if(_pos distance _x < _dist) then {
_nearest = _x;
_dist = _pos distance _x;
};
} forEach _roads;
_location = getposatl _nearest;
openMap false;
onMapSingleClick """";
Taxi_Target_Location = _location;
} else {
hint ""you need near a road!"";
};
";