GetPlayerDistanceFromPoint

GetPlayerDistanceFromPoint

Description:
Function GetPlayerDistanceFromPoint calculate the distance between a player and a map coordinate.
Function GetPlayerDistanceFromPoint was added in 0.3c R3 and will not work in earlier versions!


Parameters:
(playerid, Float:X, Float:Y, Float:Z)
int playerid The ID of the player to calculate the distance from.
float X The X map coordinate.
float Y The Y map coordinate.
float Z The Z map coordinate.


Return Values:
The distance between the player and the point as a float.


Examples:
/* when the player types '/vend' into the chat box, they'll see this.*/
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/vend", true) == 0)
    {
        new
            Float: fDistance = GetPlayerDistanceFromPoint(playerid, 237.9, 115.6, 1010.2),
            szMessage[44];
 
        format(szMessage, sizeof(szMessage), "You're %0.2f meters away from the vending machine.", fDistance);
        SendClientMessage(playerid, 0xA9C4E4FF, szMessage);
        return 1;
    }
    return 0;
}


Related Functions
The following functions may be useful, as they are related to this function in one way or another.