IsElementWithinMarker: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (→‎Syntax: OOP)
m (Time travel with a new OOP feature! marker:isElementWithin(element)!)
Line 6: Line 6:
<syntaxhighlight lang="lua">bool isElementWithinMarker ( element theElement, marker theMarker )</syntaxhighlight>
<syntaxhighlight lang="lua">bool isElementWithinMarker ( element theElement, marker theMarker )</syntaxhighlight>
{{OOP|This function is also a static function underneath the Element class.|[[element]]:isWithinMarker||}}
{{OOP|This function is also a static function underneath the Element class.|[[element]]:isWithinMarker||}}
{{New feature/item|3.0141|1.4.1|6942|'''Also: ''' [[marker]]:isElementWithin(element) is also supported!}}


===Required Arguments===
===Required Arguments===

Revision as of 23:43, 22 November 2014

This function is used to determine if an element is within a marker.

Syntax

bool isElementWithinMarker ( element theElement, marker theMarker )

OOP Syntax Help! I don't understand this!

Note: This function is also a static function underneath the Element class.
Method: element:isWithinMarker(...)


Also: marker:isElementWithin(element) is also supported!

Required Arguments

  • theElement: The element you're checking.
  • theMarker: The marker you're checking.

Returns

Returns true if the element is within the marker, false otherwise

Example

dutymarker = createMarker(126.56, 254.98, 78.9, 'cylinder', 2.0, 255, 0, 0, 150)

function duty(thePlayer, matchingDimension)
 if isElementWithinMarker(thePlayer, dutymarker) then
    giveWeapon(thePlayer, 22, 100, 1)  
 else
    outputChatBox("You are not at the right place!", thePlayer, 255, 0, 0)
 end
end
addCommandHandler("duty", duty)

See Also