- Documentation
- Server functions
- addElementDataSubscriber
Function
addElementDataSubscriber
Subscribes a player to changes of one element data value. Works with values set in "subscribe" mode: only subscribed players receive them, which saves network traffic.
Syntax
bool addElementDataSubscriber(element theElement, string key, player thePlayer)Arguments
theElementelement- The element holding the data.
keystring- The data key.
thePlayerplayer- The player who should receive the value.
Returns
true on success.
Example
Only the car owner sees its fuel level.
setElementData(vehicle, "fuel", 40, "subscribe")
addElementDataSubscriber(vehicle, "fuel", owner)