An easier way? - 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: An easier way? (
/showthread.php?tid=293814)
An easier way? -
RelaxCafe - 30.10.2011
OK, I want to set world bounds to players in a non-rectangular map.. It is like two rectangles on top of another bot one goes to the left, one to the right...
Something like this
I want to save the trouble by getting the players position when he is in between them.. etc.. so is there an easier way?
If not, how do i get if a player is in between 4 points on a graph(map)..
Something like this

Which is a tilted figure.. this would help me on making it easier..
I can't think of anything right now.. I am too tired..
Regards.
Re: An easier way? -
[MG]Dimi - 30.10.2011
You cant set world bounds in non-rectangular map.
ANd if you need how to get minx,maxx,miny and maxy look here:
Код:
Pos1========Pos2
|| ||
|| ||
|| ||
Pos3========Pos4
Pos 1 = Min X and Max Y
Pos 2 = Max X and Max Y
Pos 3 = Min X and Min Y
Pos 4 = Max X and Min Y
Re: An easier way? -
Gamer_Z - 30.10.2011
pawn Код:
isPlayerInArea2(playerID, Float:data[4])
{
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerID, X, Y, Z);
if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
return 1;
}
return 0;
}
use on eg this kind of data:
pawn Код:
{-36.5483,-57.9948, -17.2655,-49.2967},
//MinX, MaxX, MinY, MaxY