IsPlayerInRangeOfPoint is not that difficult to understand.
Let's say you have your garage command.
You would get the coordinates of the garage, and use IsPlayerInRangeOfPoint
to see if the player is close to the garage by using a line like this.
pawn Код:
if(IsPlayerInRangeOfPoint(playerid, 3.0, 567, 600, 700))
Okay, now you see some numbers separated by commas. The first word is playerid.
That's the playerid of whoever typed this command.
The second number is the radius, in this case it's 3. So that means the player has to be
within 3 GTA units from the point.
Now the last three numbers are the x,y,z coordinates of where the player needs to be.
Example
pawn Код:
CMD:enter(playerid,params[])
{
if(IsPlayerInRangeOfPoint(playerid, 2, 300, 400, 599)) // So this line checks if he is near the 'entrance'.
{
// So if he IS near the point, then it will run the code below.
SetPlayerPos(playerid, 8, 9, 10);
SendClientMessage(playerid, -1, "You have entered the building!");
return 1;
}
else // If he isn't
{
SendClientMessage(playerid, -1, "You are not near the entrance.");
}
return 1;
}
Hope I helped, goodluck.