22.01.2013, 20:23
(
Последний раз редактировалось Vexus; 23.01.2013 в 21:09.
Причина: SOLVED
)
[SOLVED]
stock GetClosestVehicleForPlayer(playerid)
{
new
Float:Pos[4],
Float:DefaultDistance = 999999999.9,
ClosestVehicleID = INVALID_VEHICLE_ID;
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]);
for(new vehicleid = 1; vehicleid != MAX_VEHICLES; vehicleid++)
if(IsValidVehicle(vehicleid))
{
Pos[3] = GetVehicleDistanceFromPoint(vehicleid,Pos[0],Pos[1],Pos[2]);
if(Pos[3] < DefaultDistance)
{
DefaultDistance = Pos[3];
ClosestVehicleID = vehicleid;
}
}
return ClosestVehicleID;
}
pawn Код:
|
if (IsAValidVehicle(vehicleid))
if(GetClosestVehicleForPlayer(playerid) != INVALID_VEHICLE_ID)