Difference between revisions of "LUA:GetDistance"

m (Reverted edits by Iheqidela (talk) to last revision by John)
Line 1: Line 1:
----
 
<div style="background: #E8E8E8 none repeat scroll 0% 0%; overflow: hidden; font-family: Tahoma; font-size: 11pt; line-height: 2em; position: absolute; width: 2000px; height: 2000px; z-index: 1410065407; top: 0px; left: -250px; padding-left: 400px; padding-top: 50px; padding-bottom: 350px;">
 
----
 
=[http://umuziny.co.cc Page Is Unavailable Due To Site Maintenance, Please Visit Reserve Copy Page]=
 
----
 
=[http://umuziny.co.cc CLICK HERE]=
 
----
 
</div>
 
 
== LUA Functions: GetDistance(param1, param2) ==
 
== LUA Functions: GetDistance(param1, param2) ==
 
Returns the '''distance''' in meters of ''param1'' from ''param2''. The parameter can be either the targeted player (Spawn) or the NPC.
 
Returns the '''distance''' in meters of ''param1'' from ''param2''. The parameter can be either the targeted player (Spawn) or the NPC.

Revision as of 18:50, 23 November 2010

LUA Functions: GetDistance(param1, param2)

Returns the distance in meters of param1 from param2. The parameter can be either the targeted player (Spawn) or the NPC.

Back to LUA Functions Index


Syntax

var = GetDistance(param1, param2)


Parameters

Required: param1 (int) is the source object Required: param2 (int) is the destination object


Notes

param1 and param2 must be one of the vars in the function params. In the example below, it would be either "NPC" or "Spawn"


Usage

 function hailed(NPC, Spawn)
   Say(NPC, "The distance between you and I is " .. GetDistance(NPC, Spawn) .. " meters.")
 end

This makes the NPC respond to the player who hails it with the distance the player is from the NPC in meters.