Posts: 267
Threads: 64
Joined: Jul 2010
Reputation:
0
Hi,
I create a area ( X-,Y-,X+,Y+) I want after a command /test check if the player is near ( radius 100) of this area.
/test
if(player is near < 100 of x y X Y) ok
else no
Tanks for your help.
Posts: 407
Threads: 59
Joined: Jan 2012
Reputation:
0
I suggest you to use "IsPlayerInRangeOfPoint"
IsPlayerInRangeOfPoint(playerid, Float:distance/range, Float:X, Float:Y, Float:Z);
Posts: 929
Threads: 17
Joined: Mar 2012
Reputation:
0
that will not do an area!!
@op
check the "Useful functions" topic i know
there are a few
IsPlayerInArea() functions.
Posts: 929
Threads: 17
Joined: Mar 2012
Reputation:
0
and how are you suppose to make
IsPlayerInRangeOfPoint work for that?
you cant, not like they stated,
the x,y are not the center of the area so that wont work like that,
with some math i can see you getting the center of the area to use this function,
regards
Posts: 2,421
Threads: 52
Joined: Mar 2009
Reputation:
0
I know but there's more chance of it working with IsPlayerInRangeOfPoint than IsPlayerInArea.
Posts: 1,599
Threads: 164
Joined: Dec 2010
Reputation:
0
He is giving us 3 positions, and asking how to check if player is around it in a range of 100.0, so yeah, IsPlayerInRangeOfPoint will serve him.
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
If you want the center area you just need to find the difference between the maxx/minx or maxy/minx coordinates (with subtraction) then add that to the smallest value = your center coordinate(s).
But to check if a player is near the edge of an area I have no idea.
Posts: 2,421
Threads: 52
Joined: Mar 2009
Reputation:
0
IsPlayerInRangeOfPoint is definitely not ideal. Really you would need some math function that can tell you how far away from the area. It wouldn't be an easy function to make, and i have never seen one.
@ Jonny thanks. IsPlayerInRangeOfPoint does check if your near a single point, but if you increase the range that point can become very large (not the actual point but you get what i mean i hope) or bigger than the area at least. But its still not ideal i agree.
@ombre why do you want to check if a player is near an area? Cant you create a bigger area around it? Or a few smaller areas surrounding it?
Posts: 6,236
Threads: 310
Joined: Jan 2011
Reputation:
0
Can't you just make another area, that is bigger than the old one? For example
Area: 100, -100, 100, -100
To check if they are 10 meters away from the edge of the area check if they are in area 110, -110, 110, -110?
Posts: 720
Threads: 34
Joined: Dec 2010
Reputation:
0
Use mapandreas to get the Z position, GetDistanceBetweenPoints(get distance from the center of area to another point of the area) and IsPlayerInRangeOfPoint, the range would be 50 for example + the result of GetDistanceBetweenPoints, just a theory.
Posts: 446
Threads: 125
Joined: Mar 2012
Reputation:
0
Use IsPlayerInRangeOfPoint .
Posts: 267
Threads: 64
Joined: Jul 2010
Reputation:
0
thanks but i don't understand how to use it.
my aera is Xmin 2000 Xmax 2500 Ymini -1500 Ymax -1000
how to associate with IsPlayerInRangeOfPoint and the stock?