is player in range of 2 points? o.o
#1

Is there any chance to determine if player is in range of two points? For example:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1566.8317,-1691.0072,5.8906))
And this one:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 2497.3757,-1687.8939,13.5221))

Is there any way to put them together in same line basically? They will be used used for same CMD that's why
Reply
#2

Like this
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1566.8317, -1691.0072, 5.8906) && IsPlayerInRangeOfPoint(playerid, 5.0, 2497.3757, -1687.8939, 13.5221)) {
	//Things to do
}
Reply
#3

Create zone.
Reply
#4

Thanks
Reply
#5

Quote:
Originally Posted by Jessyy
Посмотреть сообщение
Like this
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1566.8317, -1691.0072, 5.8906) && IsPlayerInRangeOfPoint(playerid, 5.0, 2497.3757, -1687.8939, 13.5221)) {
	//Things to do
}
that means that he must stand near the first and the second at the same time to work...
so it should be
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1566.8317, -1691.0072, 5.8906) || IsPlayerInRangeOfPoint(playerid, 5.0, 2497.3757, -1687.8939, 13.5221))
Reply
#6

@MarkoN ...

Quote:
Originally Posted by Twinklies
Посмотреть сообщение
... if player is in range of two points? ...
Quote:
Originally Posted by MarkoN
Посмотреть сообщение
that means that he must stand near the first and the second at the same time to work...
so it should be
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, 1566.8317, -1691.0072, 5.8906) || IsPlayerInRangeOfPoint(playerid, 5.0, 2497.3757, -1687.8939, 13.5221))
The Explication:
Код:
Point 1 = {X1, Y1, Z1};
Point 2 = {X2, Y2, Z2};

Purple colour	= "The player"
Green colour	= "Point 1";
Blue colour	= "Point 2";
Red colour	= "Intersection of 'Point 1' whit 'Point 2'"
MY.IDEEA: [Jessyy]
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, X1, Y1, Z1) && IsPlayerInRangeOfPoint(playerid, 5.0, X2, Y2, Z2)) {
	print("YES");
}
else {
	print("NO");
}
YOUR.IDEEA: [MarkoN]
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, X1, Y1, Z1) || IsPlayerInRangeOfPoint(playerid, 5.0, X2, Y2, Z2)) {
	print("YES");
}
else {
	print("NO");
}
First case:
Quote:

PRINTOUT - MY.IDEEA: "NO"
PRINTOUT - YOUR.IDEEA: "YES"
Second case:
Quote:

PRINTOUT - MY.IDEEA: "NO"
PRINTOUT - YOUR.IDEEA: "YES"
Third case:
Quote:

PRINTOUT - MY.IDEEA: "YES"
PRINTOUT - YOUR.IDEEA: "YES"
Read this https://sampwiki.blast.hk/wiki/Control_Structures#if ...
Reply
#7

Quote:
Originally Posted by Jessyy
Посмотреть сообщение
@MarkoN ...




The Explication:
Код:
Point 1 = {X1, Y1, Z1};
Point 2 = {X2, Y2, Z2};

Purple colour	= "The player"
Green colour	= "Point 1";
Blue colour	= "Point 2";
Red colour	= "Intersection of 'Point 1' whit 'Point 2'"
MY.IDEEA: [Jessyy]
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, X1, Y1, Z1) && IsPlayerInRangeOfPoint(playerid, 5.0, X2, Y2, Z2)) {
	print("YES");
}
else {
	print("NO");
}
YOUR.IDEEA: [MarkoN]
Код:
if(IsPlayerInRangeOfPoint(playerid, 5.0, X1, Y1, Z1) || IsPlayerInRangeOfPoint(playerid, 5.0, X2, Y2, Z2)) {
	print("YES");
}
else {
	print("NO");
}
First case:

Second case:

Third case:

Read this https://sampwiki.blast.hk/wiki/Control_Structures#if ...
That was a great presentation, but you're wrong in this case only. In order for the command to work for either points it has to be
pawn Код:
IsPlayerInRangeOfPoint(...) || IsPlayerInRangeOfPoint(...)
|| is like OR.
To make it so the player has to be in both points for the command to work(which won't ever be true in this case) it would be with && instead.
Reply
#8

My english fails me ... for what reason when I'm reading "... if player is in range of two points? ..." I understand that is intersection of 2 points (&&) ...
My bad ... I'm cleary a damn ass winner ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)