get closest vehicle near me, but not my vehicle
#3

pawn Код:
stock FindClosestVehicle(playerid)
{
    new
        Float:x, Float:y, Float:z,
        closest = -1;

    for(new a = 0; a < MAX_VEHICLES; a++)
    {
        GetVehiclePos(a, x, y, z);

        if(a != YOUR_VEHICLEID_OR_ARRAY/VARIBLE && IsPlayerInRangeOfPoint(playerid, 10.0, x, y, z))
        {
            closest = a;
        }
    }
    if(closest != -1) return closest;
   
    return INVALID_VEHICLE_ID;
}
Just added a new conditional for your vehicle varible / array, just replace with what tells your script it's your vehicle.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)