SetElementData: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 18: Line 18:
Returns ''true'' if the data was set succesfully, ''false'' otherwise.
Returns ''true'' if the data was set succesfully, ''false'' otherwise.


==Example==
<section name="Server" class="server" show="false">
<section name="Server" class="server" show="false">
==Example==
This example allows for a player to add a custom tag onto their nickname, and also revert it back to normal if they wish
This example allows for a player to add a custom tag onto their nickname, and also revert it back to normal if they wish
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">

Revision as of 11:57, 12 August 2007

This function stores data attached to an element. This data can be any primitive LUA type or MTA element (but not a text item or display).

Element data is a useful way to store data attached to players.

Syntax

bool setElementData ( element theElement, string key, var value ) 

Required Arguments

  • theElement: The element you wish to attach the data to
  • key: The key you wish to store the data under
  • value: The value you wish to store

Returns

Returns true if the data was set succesfully, false otherwise.

Example

Click to expand [+]
Server

See Also