OnElementStopSync: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
-ffs-Sniper (talk | contribs) m (→Example:   Spaces ftw)  | 
				-ffs-Sniper (talk | contribs)  m (→Example)  | 
				||
| Line 17: | Line 17: | ||
==Example==  | ==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.  | 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">  | ||
--create our testing vehicle onResourceStart  | --create our testing vehicle onResourceStart  | ||
| Line 35: | Line 34: | ||
addEventHandler( "onElementStopSync", getRootElement(), syncStop )    | addEventHandler( "onElementStopSync", getRootElement(), syncStop )    | ||
</syntaxhighlight>  | </syntaxhighlight>  | ||
{{See also/Server event|Element events}}  | {{See also/Server event|Element events}}  | ||
Revision as of 23:31, 28 March 2012
This event is triggered when an element is no longer synced by a player.
Parameters
player oldSyncer
- oldSyncer: player element representing the last player who was syncing the element
 
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.
--create our testing vehicle onResourceStart
addEventHandler ( "onResourceStart", getResourceRootElement( ),
function ( )
    vehicle = createVehicle ( 520, 0, 0, 0 )
end )
function syncStop ( oldSyncer )
    -- check if the element that stopped being synced was our vehicle
    if source == vehicle then
        --tell the player (oldSyncer) he stopped syncing the vehicle
        outputChatBox ( "The vehicle is not being synced by you anymore", oldSyncer )
    end
end
--add the event handler
addEventHandler( "onElementStopSync", getRootElement(), syncStop ) 
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