Closet Distance! [REP]
#4

You did not talk about checkpoints at all in your topic, you should have explained from the beginning..
And the whichone = 1; means that the closest coords are the first ones by default, if there are closer coords they will be set instead of the first ones, anyway:
Код:
GetClosestCoordinate(playerid)
{
	new Float:dist, whichone;
	dist = GetPlayerDistanceFromPoint(playerid, 1929.37,-1776.23,13.546;
	whichone = 1;
	if(dist < GetPlayerDistanceFromPoint(playerid, 1833.11,-1842.56,13.578))
	{
		dist = GetPlayerDistanceFromPoint(playerid, 1833.11,-1842.56,13.578);
		whichone = 2;
	}
	if(dist < GetPlayerDistanceFromPoint(playerid,1833.11,-1842.56,13.578))
	{
		dist = GetPlayerDistanceFromPoint(playerid,1833.11,-1842.56,13.578);
		whichone = 3;
	}
	if(dist < GetPlayerDistanceFromPoint(playerid,1533.11,-842.56,3.578))
	{
		dist = GetPlayerDistanceFromPoint(playerid,1533.11,-842.56,3.578);
		whichone = 4;
	}
	if(dist < GetPlayerDistanceFromPoint(playerid,-53.11,-12.56,6.578)) whichone = 5;
	switch(whichone)
	{
		case 1: return SetPlayerCheckpoint(playerid, 1929.37,-1776.23,13.546, 2);
		case 2: return SetPlayerCheckpoint(playerid, 1833.11,-1842.56,13.578, 2);
		case 3: return SetPlayerCheckpoint(playerid, 1833.11,-1842.56,13.578, 2);
		case 4: return SetPlayerCheckpoint(playerid, 1533.11,-842.56,3.578, 2);
		case 5: return SetPlayerCheckpoint(playerid, -53.11,-12.56,6.578, 2);
	}
}
EDIT: I forgot to set the checkpoints size, edited the code
Reply


Messages In This Thread
Closet Distance! [REP] - by zeth98 - 04.09.2015, 11:28
Re: Closet Distance! [REP] - by Battlezone - 04.09.2015, 11:58
Re: Closet Distance! [REP] - by zeth98 - 04.09.2015, 12:03
Re: Closet Distance! [REP] - by Battlezone - 04.09.2015, 12:09
Re: Closet Distance! [REP] - by Freezo - 04.09.2015, 12:23
Re: Closet Distance! [REP] - by Battlezone - 04.09.2015, 12:33
Re: Closet Distance! [REP] - by Freezo - 04.09.2015, 12:38
Re: Closet Distance! [REP] - by Battlezone - 04.09.2015, 12:45
Re: Closet Distance! [REP] - by Freezo - 04.09.2015, 13:06
Re: Closet Distance! [REP] - by Battlezone - 04.09.2015, 13:09

Forum Jump:


Users browsing this thread: 1 Guest(s)