IsElementLocal: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
(Improve example.) |
||
(4 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Client function}} | |||
This function checks whether a clientside [[element]] is local to the client (doesn't exist in the server) or not. | This function checks whether a clientside [[element]] is local to the client (doesn't exist in the server) or not. | ||
Line 6: | Line 7: | ||
bool isElementLocal ( element theElement ) | bool isElementLocal ( element theElement ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{New feature/item|3.0141|1.4.0|6987|{{OOP||[[element]]:isLocal|localElement}}}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
Line 16: | Line 18: | ||
This clientside function destroys all local radar blips. | This clientside function destroys all local radar blips. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function destroyAllLocalBlips ( ) | function destroyAllLocalBlips() | ||
-- | -- Get a table containing all blips | ||
local allBlips = getElementsByType( "blip" ) | local allBlips = getElementsByType("blip") | ||
-- | -- For each blip in this table | ||
for | |||
-- | for blipID = 1, #allBlips do | ||
if isElementLocal ( | local blipElement = allBlips[blipID] | ||
-- | -- Check if it's a blip that only exists locally | ||
destroyElement ( | |||
if isElementLocal(blipElement) then | |||
-- And destroy it in that case | |||
destroyElement(blipElement) | |||
end | end | ||
end | end |
Latest revision as of 08:54, 27 October 2021
This function checks whether a clientside element is local to the client (doesn't exist in the server) or not.
Syntax
bool isElementLocal ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:isLocal(...)
- Variable: .localElement
Required Arguments
- theElement: The element that we want to check.
Returns
Returns true if the passed element is local, false if not or if invalid parameters are passed.
Example
This clientside function destroys all local radar blips.
function destroyAllLocalBlips() -- Get a table containing all blips local allBlips = getElementsByType("blip") -- For each blip in this table for blipID = 1, #allBlips do local blipElement = allBlips[blipID] -- Check if it's a blip that only exists locally if isElementLocal(blipElement) then -- And destroy it in that case destroyElement(blipElement) end end end
See Also
- 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