09.05.2013, 21:34
Quote:
Try
Код:
stock GetClosestVehicle(playerid) { new vehicleid = INVALID_VEHICLE_ID; new Float:distance = 99999.0; new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); for(i = 0; i < MAX_VEHICLES; i++) { if(GetVehicleDistanceFromPoint(i, X, Y, Z) < distance && distance < 8.0) //you can change this value { vehicleid = i; distance = GetVehicleDistanceFromPoint(i, X, Y, Z); } } return vehicleid; } |