20.05.2017, 06:33
Try
PHP код:
stock GetClosestVehicle(playerid, Float:range)
{
new Float:p_X;
new Float:p_Y;
new Float:p_Z;
new Float:Vpos[3];
GetPlayerPos(playerid, p_X, p_Y, p_Z);
for(new vehicleid=1; vehicleid < MAX_VEHICLES; vehicleid++)
{
GetVehiclePos(vehicleid,Vpos[0],Vpos[1],Vpos[2]);
if(IsPlayerInRangeOfPoint(playerid,range,Vpos[0],Vpos[1],Vpos[2]))
{
return vehicleid;
}
}
return 0;
}