OnElementStopSync: Difference between revisions
Jump to navigation
Jump to search
m (→Parameters) |
(Improve example.) |
||
(2 intermediate revisions by one other user not shown) | |||
Line 17: | Line 17: | ||
This script creates a vehicle in the center of the map and outputs a message to its old syncer if he is not syncing the vehicle anymore. | This script creates a vehicle in the center of the map and outputs a message to its old syncer if he is not syncing the vehicle anymore. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function onResourceStart() | |||
local vehicleElement = createVehicle(434, 0, 0, 3) -- Create vehicle | |||
addEventHandler("onElementStopSync", vehicleElement, onElementStopSync) -- Bind handler specifically to it | |||
end | |||
addEventHandler("onResourceStart", resourceRoot, onResourceStart) | |||
function onElementStopSync(oldSyncer) | |||
outputChatBox("The vehicle is not being synced by you anymore.", oldSyncer) -- Tell player (oldSyncer) that he's not syncing vehicle | |||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{See also/Server event|Element events}} | {{See also/Server event|Element events}} |
Latest revision as of 23:50, 6 January 2023
This event is triggered when an element is no longer synced by a player.
Parameters
player oldSyncer
Source
The source of this event is the element which is no longer synced by a player.
Example
This script creates a vehicle in the center of the map and outputs a message to its old syncer if he is not syncing the vehicle anymore.
function onResourceStart() local vehicleElement = createVehicle(434, 0, 0, 3) -- Create vehicle addEventHandler("onElementStopSync", vehicleElement, onElementStopSync) -- Bind handler specifically to it end addEventHandler("onResourceStart", resourceRoot, onResourceStart) function onElementStopSync(oldSyncer) outputChatBox("The vehicle is not being synced by you anymore.", oldSyncer) -- Tell player (oldSyncer) that he's not syncing vehicle end
See Also
Element events
- onElementClicked
- onElementColShapeHit
- onElementColShapeLeave
- onElementDataChange
- onElementDestroy
- onElementDimensionChange
- onElementInteriorChange
- onElementModelChange
- onElementStartSync
- onElementStopSync
Event functions
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled