IsPlayerInArea - bugged -
MJ! - 12.09.2010
I've got this function:
pawn Код:
public IsPlayerInArea(playerid, Float:maxx, Float:minx, Float:maxy, Float:miny)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if (x > minx && x < maxx && y > miny && y < maxy)
return 1;
return 0;
}
And i tryed to take the coordinates for the red square
In the upper left corner, i typed /save and i got:
[b]-15.4505, -6.0218[/[b]
x_min = -15.4505
y_max = -6.0218
In the down right corner, i typed /save and i got:
30.1200,5.7569
x_max = 30.1200
y_min = 5.7569
and at OnPlayerUpdate, i've added:
pawn Код:
if(IsPlayerInArea(playerid,30.1200, -15.4505, -6.0218, 5.7569))
printf("%d is in area",playerid);
And i don't get any client message ...
Re: IsPlayerInArea - bugged -
Vince - 12.09.2010
Switch min and max y (the last two params).
[This forum requires that you wait 120 seconds between posts. Please try again in 16 seconds.] Go away!
Re: IsPlayerInArea - bugged -
MJ! - 12.09.2010
nop, is not so good ... is not right that size ... it's something like that ...
Re: IsPlayerInArea - bugged -
LarzI - 12.09.2010
y_max = -6.0218
y_min = 5.7569
You need to change those
y_min = -6.0218
y_max = 5.7569
Re: IsPlayerInArea - bugged -
MJ! - 12.09.2010
So the function will look like this, right ?
if(IsPlayerInArea(playerid,30.1200, -15.4505, 5.7569, -6.0218 ))
Re: IsPlayerInArea - bugged -
Toni - 12.09.2010
Its the opposite of what you have.
Its:
MinX and MinY are the first corner,
then:
MaX and MaxY are the 2nd corner.
Re: IsPlayerInArea - bugged -
willsuckformoney - 12.09.2010
if(IsPlayerInArea(playerid,-15.4505, 30.1200, -6.0218, 5.7569 ))
If the number is -blabla then have 30.blabla negative numbers are not greater than positive numbers, try that.
Re: IsPlayerInArea - bugged -
MJ! - 12.09.2010
Ok, this is working 50%
if(IsPlayerInArea(playerid,30.1200, -15.4505, 5.7569, -6.0218 )) ...
this
if(IsPlayerInArea(playerid,-15.4505, 30.1200, -6.0218, 5.7569 )) is not working
Quote:
Originally Posted by The Toni
Its the opposite of what you have.
Its:
MinX and MinY are the first corner,
then:
MaX and MaxY are the 2nd corner.
|
That's not true ... doesn't work ... make the IsPlayerInArea function with coordinates to see ...
Re: IsPlayerInArea - bugged -
LarzI - 12.09.2010
Quote:
Originally Posted by MJ!
Ok, this is working 50% if(IsPlayerInArea(playerid,30.1200, -15.4505, 5.7569, -6.0218 )) ...
|
Why only 50%? It should work 100%
Re: IsPlayerInArea - bugged -
MJ! - 12.09.2010
I don't know, it works like a small rectangle on diagonal ...