Set on or more User Variables.
User Variables are a useful tool to store user data that has to be shared with other users. When a user sets/updates/deletes one or more User Variables, all the other users in the same room are notified.
Allowed data types for User Variables are Numbers, Strings and Booleans; Arrays and Objects are not supported in order save bandwidth.
If a User Variable is set to null, it is deleted from the server. Also, User Variables are destroyed when their owner logs out or gets disconnected.
User Variables are a useful tool to store user data that has to be shared with other users. When a user sets/updates/deletes one or more User Variables, all the other users in the same room are notified.
Allowed data types for User Variables are Numbers, Strings and Booleans; Arrays and Objects are not supported in order save bandwidth.
If a User Variable is set to null, it is deleted from the server. Also, User Variables are destroyed when their owner logs out or gets disconnected.

C# | Visual Basic | Visual C++ |
public void SetUserVariables( Dictionary<string, Object> varObj, int roomId )
Public Sub SetUserVariables ( _ varObj As Dictionary(Of String, Object), _ roomId As Integer _ )
public: void SetUserVariables( Dictionary<String^, Object^>^ varObj, int roomId )

- varObj (Dictionary<(Of <(String, Object>)>))
- an object in which each property is a variable to set/update.
- roomId (Int32)
- the room id where the request was originated, in case of molti-room join (optional, default value: activeRoomId).

Sends:
SFSEvent..::.OnUserVariablesUpdateDelegate
Version:
SmartFoxServer Basic / Pro

The following example shows how to save the user data (avatar name and position) in an avatar chat application.
CopyC#

Dictionary<string, object> uVars = new Dictionary<string, object>(); uVars.Add("myAvatar", "Homer"); uVars.Add("posx", 100); uVars.Add("posy", 200); smartFox.SetUserVariables(uVars);