Hash Set
Description
Sets the value of a specified field in the hash table associated with the current client/player. This function automatically determines the appropriate hash ID based on the caller's identity, making it more convenient than hashSetId
which requires manually specifying an ID. It allows storing various data types (arrays, strings, numbers, or booleans) in a field of the client-specific hash structure.
Syntax
[_keyField, _data] call dragonfly_db_fnc_hashSet
Parameters
Parameter | Type | Description | Default |
---|---|---|---|
_keyField | String | Name of the field in the hash to set | "" |
_data | Array, String, Number, or Boolean | The value to store in the hash field |
Return Value
None. The operation runs synchronously to store the data.
Examples
Store a player's loadout:
["loadout", [getUnitLoadout player]] call dragonfly_db_fnc_hashSet;
Store player preferences:
["settings", [true, 30, "normal"]] call dragonfly_db_fnc_hashSet;
Store data from a client:
["clientInfo", [name player, getPlayerUID player]] remoteExecCall ["dragonfly_db_fnc_hashSet", 2, false];
Notes
- Stores a single field-value pair in the current client's hash table
- Both the
_keyField
and_data
parameters are required and validated - If the field already exists, its value will be overwritten
- Supports various data types: arrays, strings, numbers, and booleans
- This function automatically determines which hash table to use based on the caller's identity
- Use
hashSetId
when you need to specify a particular hash table by ID - Complex data structures should be serialized into arrays
- The operation is executed immediately and synchronously
- All operations are logged for debugging purposes
Links
Hash Get | Hash Get ID | Hash Get All | Hash Get All ID | Hash Set | Hash Set ID | Hash Set Bulk | Hash Set Bulk ID