27.12.2015, 11:12
PHP код:
public GetPlayerclosetoveh(playerid)
{
new Float:dis = 99999999.0;
new veh = -1;
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
for(new i = 1; i < MAX_VEHICLES; i++)
{
new Float:distance = GetVehicleDistanceFromPoint(i, x, y, z);
if(distance < dis)
{
dis = distance;
veh = i;
}
}
return veh;
}