GetElementSyncer: Difference between revisions
Jump to navigation
Jump to search
(New page: __NOTOC__ {{Server function}} This function gets the syncer of an element. ==Syntax== <syntaxhighlight lang="lua"> bool getElementSyncer ( element theElement ) </syntaxhighlight> ===Required Arguments=== * '''the...) |
m (→See Also) |
||
(16 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server function}} | {{Server function}} | ||
This function gets the syncer of an element. | This function gets the syncer of an element. The syncer is the player who is in control of the element. | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
element getElementSyncer ( element theElement ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
{{OOP||[[element]]:getSyncer|syncer|setElementSyncer}} | |||
===Required Arguments=== | ===Required Arguments=== | ||
* '''theElement''': The [[element]] to | * '''theElement''': The [[element]] to get the syncer of. | ||
===Returns=== | ===Returns=== | ||
Returns the [[element]] that is the syncer of ''theElement'' or ''false'' if | Returns the [[element]] that is the syncer of ''theElement'' or ''false'' if the element does not have a syncer. | ||
==Example== | ==Example== | ||
< | This code will kill the syncer of the first ped created with createPed. | ||
<syntaxhighlight lang="lua"> | |||
local elementSyncer = getElementSyncer(getElementsByType("ped")[1]) | |||
if elementSyncer and getElementType(elementSyncer) == "player" then --Check if its a player and if there is a syncer | |||
killPed(elementSyncer, elementSyncer) | |||
end | |||
</syntaxhighlight> | |||
This code will kill the syncer of the ped created with createPed. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- | function testKill(player,commandName) | ||
local idlewoodPed = createPed(26,1813.27,-1897.04,13.577) | |||
local elementSyncer = getElementSyncer(idlewoodPed) | |||
if elementSyncer and getElementType(elementSyncer) == "player" then --Check if its a player and if there is a syncer | |||
killPed(elementSyncer, elementSyncer) | |||
end | |||
end | |||
addCommandHandler("testkill", testKill) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See Also== | ==See Also== | ||
{{ | {{Element_functions|server}} | ||
Latest revision as of 22:30, 6 September 2024
This function gets the syncer of an element. The syncer is the player who is in control of the element.
Syntax
element getElementSyncer ( element theElement )
OOP Syntax Help! I don't understand this!
- Method: element:getSyncer(...)
- Variable: .syncer
- Counterpart: setElementSyncer
Required Arguments
- theElement: The element to get the syncer of.
Returns
Returns the element that is the syncer of theElement or false if the element does not have a syncer.
Example
This code will kill the syncer of the first ped created with createPed.
local elementSyncer = getElementSyncer(getElementsByType("ped")[1]) if elementSyncer and getElementType(elementSyncer) == "player" then --Check if its a player and if there is a syncer killPed(elementSyncer, elementSyncer) end
This code will kill the syncer of the ped created with createPed.
function testKill(player,commandName) local idlewoodPed = createPed(26,1813.27,-1897.04,13.577) local elementSyncer = getElementSyncer(idlewoodPed) if elementSyncer and getElementType(elementSyncer) == "player" then --Check if its a player and if there is a syncer killPed(elementSyncer, elementSyncer) end end addCommandHandler("testkill", testKill)
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