Is player near object problems.
#1

pawn Код:
stock IsPlayerNearPayphone(playerid)
{
   new Float:X, Float:Y, Float:Z;
   new Float:X2, Float:Y2, Float:Z2;
   new Float:X3, Float:Y3, Float:Z3;
   GetObjectPos(1216, X, Y, Z);
   GetObjectPos(1346, X2, Y2, Z2);
   GetObjectPos(1363, X3, Y3, Z3);
   if(IsPlayerInRangeOfPoint(playerid, 2.5, X, Y, Z)) return 1;
   if(IsPlayerInRangeOfPoint(playerid, 2.5, X2, Y2, Z2)) return 1;
   if(IsPlayerInRangeOfPoint(playerid, 2.5, X3, Y3, Z3)) return 1;
   else return 0;
}
Not sure if I did it right? When I'm near a payphone it returns 0.
Reply
#2

You need to be getting the position of the object id's, not the object models, which appears to be what you're doing. Regardless of that, you don't need to get their position at all (unless they move around) because you already know their coordinates.
Reply
#3

Why not just use the actual cords for the phone booth's with IsPlayerInRangeOfPoint
Much simpler.
Reply
#4

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Why not just use the actual cords for the phone booth's with IsPlayerInRangeOfPoint
Much simpler.
In-case there's any default phone booth's in the game...
Reply
#5

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
In-case there's any default phone booth's in the game...
Whats that got to do with it
Just use the cords for the ones your going to use.
Reply
#6

Quote:
Originally Posted by Stigg
Посмотреть сообщение
Whats that got to do with it
Just use the cords for the ones your going to use.
Because some players would complain, "THIS PHONE BOOK NOT WORK...!!"

But I guess I'm gonna have to do your idea.. thanks.
Reply
#7

That's not how you use the function GetObjectPos. Just fetch the phone booth coordinates and then apply them.
Reply
#8

Quote:
Originally Posted by Jack_Leslie
Посмотреть сообщение
Because some players would complain, "THIS PHONE BOOK NOT WORK...!!"

But I guess I'm gonna have to do your idea.. thanks.
Better still, make the ones they cant use out of order. (If you can find them of course)
Should give a little realism too. Out of order phones or boxes are everywhere irl.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)