GetElementSyncer: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
Line 16: Line 16:
==Example==
==Example==
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
This code will kill the syncer of the first ped created with createPed
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
local elementSyncer = getElementSyncer(getElementsByType("ped")[1])
local elementSyncer = getElementSyncer(getElementsByType("ped")[1])

Revision as of 11:29, 23 April 2009

This function gets the syncer of an element. The syncer is the player who is in control of the element.

Syntax

element getElementSyncer ( element theElement )

Required Arguments

  • theElement: The element to get the syncer of.

Returns

Returns the element that is the syncer of theElement or false if the element is not being synced.

Example

Click to collapse [-]
Server

This code will kill the syncer of the first ped created with createPed

local elementSyncer = getElementSyncer(getElementsByType("ped")[1])
if getElementType(elementSyncer) == "player" then
    killPed(elementSyncer,elementSyncer)
end

See Also