IsPlayerInRangeOfPoint
#1

Im trying to verify if a player is near a point from a list and then do some things with that. this is my list :
Код:
enum eZone {
    Float:x,
    Float:y,
    Float:z,
}

new ZoneInfo[][eZone] = { //COORDONЙE DU POINT CENTRAL DE L'ENDROIT
    {1411.0,-2408.8,17.379},
    {1411.0,-2408.8,17.379}
};
My verification code :
Код:
public isin(playerid) {
	new var = 0;
    for(new i = 0; i <= 1; i++) {
    	if (IsPlayerInRangeOfPoint(playerid, 45.0, ZoneInfo[i][0], ZoneInfo[i][1], ZoneInfo[i][2])) {
    	    var = 1;
    	}
   	}
   	return var;
}
when i want to see if the vehicle is near, i do this :
Код:
if(isin(playerid)) {
but it always return false (zero)
Reply
#2

You can't use '<=' or '>=' in a loop.

Instead of:
pawn Код:
for(new i = 0; i <= 1; i++) {
use:
pawn Код:
for(new i = 0; i < 1 + 1; i++) {
Reply
#3

it still say the player isn't in the radius even when im touching the object i used for the point
Reply
#4

Quote:
Originally Posted by gagnier91
Посмотреть сообщение
Im trying to verify if a player is near a point from a list and then do some things with that. this is my list :
Код:
enum eZone {
    Float:x,
    Float:y,
    Float:z,
}

new ZoneInfo[][eZone] = { //COORDONЙE DU POINT CENTRAL DE L'ENDROIT
    {1411.0,-2408.8,17.379},
    {1411.0,-2408.8,17.379}
};
My verification code :
Код:
public isin(playerid) {
	new var = 0;
    for(new i = 0; i <= 1; i++) {
    	if (IsPlayerInRangeOfPoint(playerid, 45.0, ZoneInfo[i][0], ZoneInfo[i][1], ZoneInfo[i][2])) {
    	    var = 1;
    	}
   	}
   	return var;
}
when i want to see if the vehicle is near, i do this :
Код:
if(isin(playerid)) {
but it always return false (zero)
Try this:
PHP код:
enum eZone
{
    
Float:x,
    
Float:y,
    
Float:z,
}
new 
ZoneInfo[][eZone] =
//COORDONЙE DU POINT CENTRAL DE L'ENDROIT
    
{1411.0,-2408.8,17.379},
    {
1411.0,-2408.8,17.379}
};
public 
isin(playerid)
{
    for(new 
0sizeof(ZoneInfo); i++)
    {
        if (
IsPlayerInRangeOfPoint(playerid45.0ZoneInfo[i][0], ZoneInfo[i][1], ZoneInfo[i][2]))
            return 
1;
       }
    return 
0;

Quote:
Originally Posted by antonio112
Посмотреть сообщение
You can't use '<=' or '>=' in a loop.

Instead of:
pawn Код:
for(new i = 0; i <= 1; i++) {
use:
pawn Код:
for(new i = 0; i < 1 + 1; i++) {
LOOOOOOOL ! Who told you that :O ?
Reply
#5

Are you sure you are near {1411.0,-2408.8,17.379} ?
Reply
#6

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
Are you sure you are near {1411.0,-2408.8,17.379} ?
Yes, i am.

Quote:
Originally Posted by MoroDan
Посмотреть сообщение
Try this:
PHP код:
enum eZone
{
    
Float:x,
    
Float:y,
    
Float:z,
}
new 
ZoneInfo[][eZone] =
//COORDONЙE DU POINT CENTRAL DE L'ENDROIT
    
{1411.0,-2408.8,17.379},
    {
1411.0,-2408.8,17.379}
};
public 
isin(playerid)
{
    for(new 
0sizeof(ZoneInfo); i++)
    {
        if (
IsPlayerInRangeOfPoint(playerid45.0ZoneInfo[i][0], ZoneInfo[i][1], ZoneInfo[i][2]))
            return 
1;
       }
    return 
0;

I have 3 time this warning : warning 213: tag mismatch on this line :
Код:
if (IsPlayerInRangeOfPoint(playerid, 45.0, ZoneInfo[i][0], ZoneInfo[i][1], ZoneInfo[i][2]))
and still not working..
Reply
#7

Now, i get the tag mismatch error for each thing in my array :
pawn Код:
new ZoneInfo[][eZone] =
{ //COORDONЙE DU POINT CENTRAL DE L'ENDROIT
    {1411.0,-2408.8,17.379}, //3 errors here
    {1411.0,-2408.8,17.379} //3 other errors here
};
Reply
#8

Quote:
Originally Posted by antonio112
Посмотреть сообщение
You can't use '<=' or '>=' in a loop.

Instead of:
pawn Код:
for(new i = 0; i <= 1; i++) {
use:
pawn Код:
for(new i = 0; i < 1 + 1; i++) {
Yes, you may.
Reply
#9

its now working perfectly, thank you !
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)