IsPlayerInRangeOfPoint not working
#1

Hi all,
so, I'm working on my garage system, and somehow when I create a garage, the coords are not seen by IsPlayerInRangeOfPoint.
Example:
pawn Code:
GetPlayerPos(playerid,tx1,ty1,tz1);

    GInfo[garagecount][Owned] = 0;
    format(GInfo[garagecount][Owner],32,"No One");
    GInfo[garagecount][Price] = cost;
    GInfo[garagecount][IntType] = type;

    GInfo[garagecount][GOutX] = tx1;
    GInfo[garagecount][GOutY] = ty1;
    GInfo[garagecount][GOutZ] = tz1;
    GInfo[garagecount][Opened] = 0;
GInfo[id][GOutX] means the x pos, and same for the Y and Z, the others aren't important now.

when I use my enter command, it doesn't detect the coords, check:
pawn Code:
for(new i=0; i < MAX_GARAGES; i++)
    {
   
    if(IsPlayerInRangeOfPoint(playerid,5.0,GInfo[i][GOutX],GInfo[i][GOutZ],GInfo[i][GOutZ]))
    {
    print("coords detected");
    if(GetGarageAcces(playerid,i) == 0) return ShowPlayerDialog(playerid,9999,DIALOG_STYLE_MSGBOX,"Problem..","This garage is locked.","Ok","");
   
    if(GetGarageAcces(playerid,i) == 1)
    {
    print("insidefunction");
    SaveAccount(playerid);
    new t = GInfo[i][IntType];
    SetPlayerPos(playerid,GL[t][InX],GL[t][InY],GL[t][InZ]);
    SetPlayerInterior(playerid,GL[t][Interior]);
    SetPlayerVirtualWorld(playerid,i);
    LastGarage[playerid] = i;
    return 1;
    }
As you can see, I placed debug messages for when it does detect the coords, but they it doesn't even go past it.
The coords are set, because the house pickup appears at the right place, so it's IsPlayerInRangeOfPoint that doesn't work here..
Anything I'm doing wrong? I'm using the exact same method for my house system, and it works bugfree, so this is really strange..
The main thing I want to achieve, is that the 'Coords detected' message is shown in the console.
The exact thing I want to fix is this:
pawn Code:
if(IsPlayerInRangeOfPoint(playerid,5.0,GInfo[i][GOutX],GInfo[i][GOutZ],GInfo[i][GOutZ]))
    {
The rest of the stuff works fine so far, it's just that the player isn't found in the range of the coords, event though I'm standing on that pickup.

Thanks in advance
Reply
#2

I've also had problem with this, but I just changed to 7.0 instead of 5.0 .
Reply
#3

Change to
pawn Code:
if(IsPlayerInRangeOfPoint(playerid,5.0,GInfo[i][GOutX],GInfo[i][GOutY],GInfo[i][GOutZ]))
you use GOutZ 2times and not using the GOutY..
Reply
#4

Quote:
Originally Posted by Kiyozi_Mu
View Post
Change to
pawn Code:
if(IsPlayerInRangeOfPoint(playerid,5.0,GInfo[i][GOutX],GInfo[i][GOutY],GInfo[i][GOutZ]))
you use GOutZ 2times and not using the GOutY..
Daaaamn, do I feel stupid, this must be it, thanks alot for pointing it out!

@davve95 - Thanks for suggesting that, I will increase the range anyways since you need to be detected in a car
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)