IsPlayerInRangeOfPoint
From SA-MP Wiki
IsPlayerInRangeOfPoint
Warning: This is a new function working since SA-MP 0.3. It won't work in previous versions.
There are scripted (but slower) alternatives for previous SA-MP versions.
Important note: This could be a native replacement for the PlayerToPoint function, you just need to change the parameters (PlayerToPoint requires float, then playerid, IsPlayerInRangeOfPoint requires playerid and then the Float.
Checks if the player's position is inside a sphere.
(playerid, Float:range, Float:x, Float:y, Float:z)
| playerid | The player you want to check for distance. |
| Float:range | The radius of the sphere. |
| Float:x | The X position of the middle point of the sphere. |
| Float:y | The Y position of the middle point of the sphere. |
| Float:z | The Z position of the middle point of the sphere. |
| Returns | true if player is inside the sphere, false if not. |
if(!strcmp("/stadium",cmdtext)) { if(IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438)) SendClientMessage(playerid,0xFFFFFFFF,"You are near the Stadium entrance!"); return 1; }
Related Functions
The following functions might be useful as well, as they're related to this function in one way or another.
- Automatic_Gates: PlayerToPoint function. A slower alternative to this built-in function.
