onElementStartSync | Multi Theft Auto: Wiki Skip to content

onElementStartSync

Client-side
Server-side
Shared

This event is triggered when an element becomes synced by a player.

Parameters

player newSyncer
  • newSyncer: a player element representing the player who is now syncing the element.

Source

element: The source of this event is the element that got synced by a player.

Code Examples

server

This example matches the model of the element to the player, when an element receives a new syncer.

function elementStartSync( newSyncer )
local strElementType = getElementType( source )
local playerVehicle = getPedOccupiedVehicle( newSyncer )
if ( strElementType == 'vehicle' ) then
if ( not playerVehicle ) then return false end
setElementModel( source, getElementModel(playerVehicle) )
elseif ( strElementType == 'ped' ) then
setElementModel( source, getElementModel(newSyncer) )
end
end
addEventHandler ('onElementStartSync', root, elementStartSync)

See Also

Element Functions