is player in range of 2 points? o.o -
Twinklies - 18.09.2012
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
Re: is player in range of 2 points? o.o -
Jessyy - 18.09.2012
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
}
Re: is player in range of 2 points? o.o -
Drake1994 - 18.09.2012
Create zone.
Re: is player in range of 2 points? o.o -
Twinklies - 18.09.2012
Thanks
Re: is player in range of 2 points? o.o -
MarkoN - 18.09.2012
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))
Re: is player in range of 2 points? o.o -
Jessyy - 18.09.2012
@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 ...
Re: is player in range of 2 points? o.o -
ReneG - 18.09.2012
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.
Re: is player in range of 2 points? o.o -
Jessyy - 19.09.2012
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 ...