IsPlayerInRangeOfPoint
From SA-MP Wiki
(Difference between revisions)
Revision as of 14:50, 10 August 2015 Ralfie (Talk | contribs) ← Previous diff |
Current revision Vince (Talk | contribs) (Entire wiki uses Allman style. Please stick to it, even if it's not your personal preference.) |
||
Line 22: | Line 22: | ||
if (!strcmp("/stadium", cmdtext)) | if (!strcmp("/stadium", cmdtext)) | ||
{ | { | ||
- | if (IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438)) { | + | if (IsPlayerInRangeOfPoint(playerid, 7.0, 2695.6880, -1704.6300, 11.8438)) |
+ | { | ||
SendClientMessage(playerid,0xFFFFFFFF,"You are near the stadium entrance!"); | SendClientMessage(playerid,0xFFFFFFFF,"You are near the stadium entrance!"); | ||
} | } |
Current revision
Description:
Checks if a player is in range of a point. This native function is faster than the PAWN implementation using distance formula.
(playerid, Float:range, Float:x, Float:y, Float:z)
playerid | The ID of the player. |
Float:range | The furthest distance the player can be from the point to be in range. |
Float:x | The X coordinate of the point to check the range to. |
Float:y | The Y coordinate of the point to check the range to. |
Float:z | The Z coordinate of the point to check the range to. |
Return Values:
- true - The player is in range of the point.
- false - The player is not in range of the point.
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; }
[edit]
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetPlayerDistanceFromPoint: Get the distance between a player and a point.
- GetVehicleDistanceFromPoint: Get the distance between a vehicle and a point.
- GetPlayerPos: Get a player's position.