GetElementZoneName: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (optional arg in syntax)
Line 4: Line 4:
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
string getElementZoneName ( element theElement, bool citiesonly )
string getElementZoneName ( element theElement, [bool citiesonly=false] )
</syntaxhighlight>
</syntaxhighlight>



Revision as of 16:30, 18 November 2006

This function allows you to retrieve the zone name of an element (eg. Verdant Bluffs or Ocean Docks)

Syntax

string getElementZoneName ( element theElement, [bool citiesonly=false] )

Required Arguments

  • theElement: The element in which you'd like to retrieve the zone name from

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • citiesonly: An optional argument to choose if you want to return the city name (eg Las Venturas)

Returns

Returns the string of the elements zone name

Example

This example shows you how to return your own location by doing /loc in the chatbox or just loc in console

addCommandHandler("loc", "playerloc")
function playerloc ( source )
  local playername = getClientName ( source )
  local location = getElementZoneName ( source )
  outputChatBox ( "* " ..playername.. "'s Location: " ..location, root, 0, 255, 255 ) -- Output the player's name and zone name
end

See Also