SA-MP Forums Archive
Making a streamer - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Making a streamer (/showthread.php?tid=289150)



Making a streamer - Ehab1911 - 10.10.2011

Hello, I am currently making a streamer and I need distance function.

Thank you in advance!


Re: Making a streamer - Mrpanghang - 10.10.2011

This is something maybe

Код:
stock Distance(Float:x,Float:y,Float:xx,Float:yy)
{
new XDist = Abs(x - xx);
new YDist = Abs(y - yy);
	if(XDist > YDist)
	{
	return XDist;
	}
	else
	{
	return YDist;
	}
}
You should use it like this DistanceBetweenPoints = Distance(myx,myy,targetx,targety);