GetElementZoneName: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (→See Also) |
||
(4 intermediate revisions by 4 users not shown) | |||
Line 2: | Line 2: | ||
__NOTOC__ | __NOTOC__ | ||
This function allows you to retrieve the zone name of an element (eg. Verdant Bluffs or Ocean Docks) | This function allows you to retrieve the zone name of an element (eg. Verdant Bluffs or Ocean Docks) | ||
The same can be achieved client side by getting element coordinates and using [[GetZoneName]]. | |||
==Syntax== | ==Syntax== | ||
Line 7: | Line 9: | ||
string getElementZoneName ( element theElement, [bool citiesonly=false] ) | string getElementZoneName ( element theElement, [bool citiesonly=false] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:getZoneName||}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 22: | Line 25: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function playerloc ( source ) | function playerloc ( source ) | ||
local playername = | local playername = getPlayerName ( source ) | ||
local location = getElementZoneName ( source ) | local location = getElementZoneName ( source ) | ||
outputChatBox ( "* " .. playername .. "'s Location: " .. location, getRootElement(), 0, 255, 255 ) -- Output the player's name and zone name | outputChatBox ( "* " .. playername .. "'s Location: " .. location, getRootElement(), 0, 255, 255 ) -- Output the player's name and zone name | ||
Line 30: | Line 33: | ||
==See Also== | ==See Also== | ||
{{ | {{Element_functions|server}} |
Latest revision as of 22:30, 6 September 2024
This function allows you to retrieve the zone name of an element (eg. Verdant Bluffs or Ocean Docks)
The same can be achieved client side by getting element coordinates and using GetZoneName.
Syntax
string getElementZoneName ( element theElement, [bool citiesonly=false] )
OOP Syntax Help! I don't understand this!
- Method: element:getZoneName(...)
Required Arguments
- theElement: The element 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
function playerloc ( source ) local playername = getPlayerName ( source ) local location = getElementZoneName ( source ) outputChatBox ( "* " .. playername .. "'s Location: " .. location, getRootElement(), 0, 255, 255 ) -- Output the player's name and zone name end addCommandHandler ( "loc", playerloc )
See Also
- addElementDataSubscriber
- clearElementVisibleTo
- cloneElement
- getElementSyncer
- getElementZoneName
- hasElementDataSubscriber
- isElementVisibleTo
- removeElementData
- removeElementDataSubscriber
- setElementSyncer
- setElementVisibleTo
- Shared
- attachElements
- createElement
- destroyElement
- detachElements
- getAttachedElements
- getElementAlpha
- getElementAttachedOffsets
- getElementAttachedTo
- getElementByIndex
- getElementByID
- getElementChild
- getElementChildren
- getElementChildrenCount
- getElementCollisionsEnabled
- getElementColShape
- getElementData
- getAllElementData
- hasElementData
- getElementDimension
- getElementHealth
- getElementID
- getElementInterior
- getElementMatrix
- getElementModel
- getElementParent
- getElementPosition
- getElementRotation
- getElementsByType
- getElementsWithinColShape
- getElementsWithinRange
- getElementType
- getElementVelocity
- getLowLODElement
- getRootElement
- isElement
- isElementAttached
- isElementCallPropagationEnabled
- isElementDoubleSided
- isElementFrozen
- isElementInWater
- isElementLowLOD
- isElementWithinColShape
- isElementWithinMarker
- setElementAlpha
- setElementAngularVelocity
- getElementAngularVelocity
- setElementAttachedOffsets
- setElementCallPropagationEnabled
- setElementCollisionsEnabled
- setElementData
- setElementDimension
- setElementDoubleSided
- setElementFrozen
- setElementHealth
- setElementID
- setElementInterior
- setElementModel
- setElementParent
- setElementPosition
- setElementRotation
- setElementVelocity
- setLowLODElement
- getPedContactElement
- getResourceDynamicElementRoot
- getResourceRootElement