SA-MP Forums Archive
Find random coordinates in area - 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: Find random coordinates in area (/showthread.php?tid=616176)



Find random coordinates in area - MerryDeer - 01.09.2016

Hi,

I have area, and i need when player enter to it, place player somewhere random (from that area), with my given distance


Re: Find random coordinates in area - AbyssMorgan - 01.09.2016

Use this you need

PHP код:
GetRandomPointInCircle(Float:x,Float:y,Float:radius,&Float:tx,&Float:ty);
GetRandomPointInCylinderEx(Float:x,Float:y,Float:minz,Float:maxz,Float:radius,&Float:tx,&Float:ty,&Float:tz);
GetRandomPointInSphere(Float:x,Float:y,Float:z,Float:radius,&Float:tx,&Float:ty,&Float:tz);
GetRandomPointInRectangle(Float:minx,Float:miny,Float:maxx,Float:maxy,&Float:tx,&Float:ty);
GetRandomPointInCube(Float:minx,Float:miny,Float:minz,Float:maxx,Float:maxy,Float:maxz,&Float:tx,&Float:ty,&Float:tz); 
3DTryg:
https://sampforum.blast.hk/showthread.php?tid=591010


Re: Find random coordinates in area - IFilip - 01.09.2016

Код:
forward Float: RandomFloat(Float: min, Float: max);
Float: RandomFloat(Float: min, Float: max)
{
	return random(floatround(max) - floatround(min))+ min;
}