GetClosestVehicle(...) is not working
#3

Код:
stock GetClosestVehicle(playerid)
{
	new
		Float:fPos[3],
		Float:distance = 30,
		Float:curdistance,
		currentVehicle;
	
	for(new v = 0; v < MAX_VEHICLES; v++)
	{
		GetVehiclePos(v, fPos[0], fPos[1], fPos[2]);		
		curdistance = GetPlayerDistanceFromPoint(playerid, fPos[0], fPos[1], fPos[2]);
		
		if(curdistance < distance)
		{
			currentVehicle = v;
			distance = curdistance;
		}
	}
	return currentVehicle;
}
I used this stock in my previous script, found it online. This doesn't have a range but you can specify it as fixed if you want.. I'm still learning but trying to help you as best as i can!
Reply


Messages In This Thread
[SOLVED]GetClosestVehicle(...) is not working - by Sibuscus - 29.06.2018, 18:20
Re: GetClosestVehicle(...) is not working - by Calisthenics - 29.06.2018, 18:25
Re: GetClosestVehicle(...) is not working - by Uvais - 29.06.2018, 18:29
Re: GetClosestVehicle(...) is not working - by Sibuscus - 29.06.2018, 18:33
Re: GetClosestVehicle(...) is not working - by Calisthenics - 29.06.2018, 18:36
Re: GetClosestVehicle(...) is not working - by Lokii - 29.06.2018, 18:56

Forum Jump:


Users browsing this thread: 1 Guest(s)