# NPC:GetDistanceFromMeToPoint

### From SA-MP Wiki

(Difference between revisions)

Revision as of 15:14, 9 December 2016OstGot (Talk | contribs) ← Previous diff |
Current revisionFreaksken (Talk | contribs) |
||

Line 5: |
Line 5: | ||

{{Description|Get the distance between the NPC and a point.}} | {{Description|Get the distance between the NPC and a point.}} | ||

- | {{Parameters|Float:x, Float:y, Float:z, Float:Distance}} | + | {{Parameters|Float:x, Float:y, Float:z, &Float:Distance}} |

{{Param|Float:x|The X coordinate of the point.}} | {{Param|Float:x|The X coordinate of the point.}} | ||

{{Param|Float:y|The Y coordinate of the point.}} | {{Param|Float:y|The Y coordinate of the point.}} | ||

{{Param|Float:z|The Z coordinate of the point.}} | {{Param|Float:z|The Z coordinate of the point.}} | ||

- | {{Param|Float:Distance|A float to save the distance in, passed by reference.}} | + | {{Param|&Float:Distance|A float to save the distance in, passed by reference.}} |

{{NoReturn}} | {{NoReturn}} |

## Current revision

**Description:**

Get the distance between the NPC and a point.

**Parameters:**

(Float:x, Float:y, Float:z, &Float:Distance)

Float:x | The X coordinate of the point. |

Float:y | The Y coordinate of the point. |

Float:z | The Z coordinate of the point. |

&Float:Distance | A float to save the distance in, passed by reference. |

**Return Values:**

This function does not return any specific values.

**Example Usage:**

new Float:distance; GetDistanceFromMeToPoint(2.0, 3.0, 2.0, distance); printf("The distance between the npc and the point (2.0, 3.0, 2.0) is %f", distance);

[edit]

### **Related Functions**

The following functions may be helpful as they relate to this function in one way or another.

- NPC:GetMyPos: Get the NPC's position.

- NPC:SetMyPos: Set the NPC's position.