05.02.2013, 19:35
Sure,
Here it is:
Thanks in advance!
Here it is:
pawn Код:
stock GetNearestVehicle(playerid, Float:dis)
{
new Float:L, Float:O, Float:II;
if(GetPlayerPos(playerid, L, O, II))
{
new vehicleid = INVALID_VEHICLE_ID;
for(new v, Float:temp, Float:VL, Float:VO, Float:VII; v != MAX_VEHICLES; v++)
{
if(GetVehiclePos(v, VL, VO, VII) && v != GetPlayerVehicleID(playerid))
{
VL -= L, VO -= O, VII -= II;
temp = VL * VL + VO * VO + VII * VII;
if(temp < dis) dis = temp, vehicleid = v;
}
}
dis = floatpower(dis, 1.5);
return vehicleid;
}
return INVALID_VEHICLE_ID;
}