GetDistanceBetweenPoints2D

From Multi Theft Auto: Wiki
Revision as of 13:56, 30 March 2006 by ChrML (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Description

This function returns the distance between point x1, y1 and point x2, y2 using the pythagorean theorem.

Syntax

float getDistanceBetweenPoints2D ( float x1, float y1, float x2, float y2 )

Required Arguments

  • x1: The X position of the first point
  • y1: The Y position of the first point
  • x2: The X position of the second point
  • y2: The Y position of the second point

Example

vehiclex, vehicley, vehiclez = getVehiclePosition ( vehicle )
vehicle2x, vehicle2y, vehicle2z = getVehiclePosition ( vehicle2 )
serverChat ( "The map distance between vehicle and vehicl2 is ", getDistanceBetweenPoints2D ( vehiclex, vehicley, vehicle2x, vehicle2y ) )