SetElementSyncer: Difference between revisions
(Created page with '{{Server function}} __NOTOC__ This function can be used to change the syncer (player) of an element. The function can be also used to remove element's syncer making it go ou…') |
No edit summary |
||
Line 1: | Line 1: | ||
{{Server function}} | {{Server function}} | ||
__NOTOC__ | __NOTOC__ | ||
This function can be used to change the syncer ([[player]]) of an element. The function can be also used to remove element's syncer | This function can be used to change the syncer ([[player]]) of an element. The function can be also used to remove element's syncer. | ||
Using the function to change an elements syncer will only last as long as the element is within syncable range of the player. (i.e. It is streamed in for that player). As soon as it becomes impossible for your chosen player to sync the element, another player will be automatically selected, and your setting will be lost. With vehicles, the last passenger to leave a vehicle will be selected as the syncer and override any setting you may have made. | |||
Using the function to turn off an elements syncer, means no player will be assigned to syncing the element. That will not be changed until setElementSyncer is called again. | |||
It should be noted that certain network changes to an element do not require a syncer. Things such as destroying an element or explicitly setting the elements position (in a server side script), will still be updated on all clients regardless of this setting. | |||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setElementSyncer ( element theElement, | bool setElementSyncer ( element theElement, player thePlayer ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theElement:''' The [[element]] whose syncer you wish to change. | *'''theElement:''' The [[element]] whose syncer you wish to change. | ||
*'''thePlayer:''' The [[player]] who should be the new syncer of the element. If set to [[false]], this element will not have a syncer. If set to [[true]], the most relevant player will become the elements syncer. | |||
*'''thePlayer:''' The [[player]] who should be the new syncer of the element. | |||
===Returns=== | ===Returns=== |
Revision as of 23:15, 23 April 2010
This function can be used to change the syncer (player) of an element. The function can be also used to remove element's syncer.
Using the function to change an elements syncer will only last as long as the element is within syncable range of the player. (i.e. It is streamed in for that player). As soon as it becomes impossible for your chosen player to sync the element, another player will be automatically selected, and your setting will be lost. With vehicles, the last passenger to leave a vehicle will be selected as the syncer and override any setting you may have made.
Using the function to turn off an elements syncer, means no player will be assigned to syncing the element. That will not be changed until setElementSyncer is called again. It should be noted that certain network changes to an element do not require a syncer. Things such as destroying an element or explicitly setting the elements position (in a server side script), will still be updated on all clients regardless of this setting.
Syntax
bool setElementSyncer ( element theElement, player thePlayer )
Required Arguments
- theElement: The element whose syncer you wish to change.
- thePlayer: The player who should be the new syncer of the element. If set to false, this element will not have a syncer. If set to true, the most relevant player will become the elements syncer.
Returns
Returns true if the syncer was changed succesfully, false otherwise.
Example
-- TODO
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