M MY Multiplayer: Wiki
Side
Kind

setElementSyncer

Server

Chooses which player syncs a ped or vehicle.

bool setElementSyncer(element element [, player|nil player = nil, bool enable = true])

Parameters

NameTypeDescription
elementelementThe ped or vehicle.
playerplayer|nilThe player who syncs it from now on. With nil, nobody syncs it.default nil
enableboolfalse stops the server from choosing anyone to sync it, and the given player is ignored.default true

Returns

true if it applied, false if the element is not a ped or vehicle.

Example

addCommandHandler("drive", function(player)
    local vehicle = createVehicle("infernus", 2495, -1687, 13.5)
    setElementSyncer(vehicle, player)
end)
NoteThe player only starts syncing if it already knows the element.

See also