Posts: 1,648
Threads: 482
Joined: Jun 2010
pawn Код:
if(!IsPlayerInRangeOfPoint(playerid, 20.0, -240.2907,1209.9883,19.7422)|| !IsPlayerInRangeOfPoint(playerid, 50.0,-1327.7439,2675.7014,50.0625)|| !IsPlayerInRangeOfPoint(playerid, 10.0, 609.0861,1698.3657,6.9922)) return SendClientMessage(playerid, COLOUR_GREY, "You must be at a Gas Station to refuel.");
It always returns: You must be at a Gas Station to refuel, although I'm in range of the points.
Posts: 1,662
Threads: 199
Joined: Dec 2011
Reputation:
0
Dont use the !
Make it in a way it only continues if it is TRUE instead of FALSE
thats how I always work
Posts: 1,648
Threads: 482
Joined: Jun 2010
So how would I re-write it?
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
The double pipes mean OR, not AND. In your case you need AND (&&). I read code in my mind like this:
if not IsPlayerInRangeOfPoint OR not IsPlayerInRangeOfPoint OR not IsPlayerInRangeofPoint then do : ...
As you can see, it doesn't make sense. This however, makes a lot more sense:
if not IsPlayerInRangeOfPoint AND not IsPlayerInRangeOfPoint AND not IsPlayerInRangeOfPoint then do : ...
Posts: 1,648
Threads: 482
Joined: Jun 2010
Thanks Vince, that's made it a lot clearer for me to understand!