RemoveElementDataSubscriber: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 23: Line 23:
<section name="Server" class="server" show="true">
<section name="Server" class="server" show="true">
<syntaxhighlight>
<syntaxhighlight>
TODO
addEventHandler("onVehicleLeave", getRootElement(), function(thePlayer, seat)
      removeElementDataSubscriber(source, "id", thePlayer)
  end)
</syntaxhighlight>
</syntaxhighlight>
</section>
</section>

Revision as of 17:01, 16 September 2021

This function unsubscribes a player from specific element data. This function is used together with setElementData in "subscribe" mode.

Syntax

bool removeElementDataSubscriber ( element theElement, string key, player thePlayer )

OOP Syntax Help! I don't understand this!

Method: element:removeDataSubscriber(...)
Counterpart: addElementDataSubscriber


Required Arguments

  • theElement: The element you wish to unsubscribe the player from.
  • key: The key you wish to unsubscribe the player from.
  • thePlayer: The player you wish to unsubscribe.

Returns

Returns true if the player was unsubscribed, false otherwise.

Example

Click to collapse [-]
Server
addEventHandler("onVehicleLeave", getRootElement(), function(thePlayer, seat)
      removeElementDataSubscriber(source, "id", thePlayer) 
   end)

Requirements

Minimum server version 1.5.7-9.20477
Minimum client version n/a

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version server="1.5.7-9.20477" />

See Also