OnClientElementDataChange: Difference between revisions

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


==Source==
==Source==
The [[event system#Event source|source]] of this event is the [[element]] that had its element data changed
The [[event system#Event source|source]] of this event is the [[element]] that had its element data changed.


==Example==  
==Example==  

Revision as of 22:24, 2 April 2018

This event is triggered whenever an element's data is changed.

Parameters

string dataName, string oldValue
  • dataName: a string representing the element data that was changed.
  • oldValue: a string representing the value before changed element data.

Source

The source of this event is the element that had its element data changed.

Example

This example tells the client whenever a player's "score" element data is changed.

addEventHandler ( "onClientElementDataChange", getRootElement(),
function ( dataName )
	if getElementType ( source ) == "player" and dataName == "score" then
		outputChatBox ( getPlayerName(source).."'s new score is "..getElementData (source, "score").."!" )
	end
end )

See Also

Client element events


Client event functions