From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This function removes the element data with the given key for that element. The element data removal is synced with all the clients.

[[{{{image}}}|link=|]] Note: If you want to remove the data in client side you can use 'setElementData(element, key, nil)'.


bool removeElementData ( element theElement, string key ) 

OOP Syntax Help! I don't understand this!

Method: element:removeData(...)

Required Arguments

  • theElement: The element you wish to remove the data from.
  • key: The key string you wish to remove.


Returns true if the data was removed succesfully, false if the given key does not exist in the element or the element is invalid.


This will set element data for player which spawned, and then remove it on death.

function onPlayerSpawn()
    setElementData(source, "playerSpawned", true)
addEventHandler("onPlayerSpawn", root, onPlayerSpawn)

function onPlayerWasted()
    removeElementData(source, "playerSpawned")
addEventHandler("onPlayerWasted", root, onPlayerWasted)

See Also