Hash Set Bulk ID
Description
Sets multiple field-value pairs in a specific hash table identified by its key in a single operation. This function allows efficiently storing multiple related fields at once for a specific identifier, reducing the number of separate database calls required. It's ideal for saving a collection of player-specific or entity-specific data.
Syntax
[_data] call dragonfly_db_fnc_hashSetIdBulk
Parameters
Parameter | Type | Description | Default |
---|---|---|---|
_data | Array | Array with key followed by alternating field names and values |
Return Value
None. The operation runs synchronously to store all the data.
Examples
Store player loadout and position:
[[getPlayerUID player, "loadout", [getUnitLoadout player], "position", [getPosASLVisual player]]] call dragonfly_db_fnc_hashSetIdBulk;
Store multiple vehicle properties:
[["vehicle_123", "fuel", [0.75], "damage", [0.2], "crew", [["player1", "player2"]]]] call dragonfly_db_fnc_hashSetIdBulk;
Store player data from a client:
[[getPlayerUID player, "stats", [score player], "inventory", [getAllGear player]]] remoteExecCall ["dragonfly_db_fnc_hashSetIdBulk", 2, false];
Notes
- The data array must be structured with the key first, followed by alternating field names and values:
[key, field1, [value1], field2, [value2], ...]
- The key must be a string that identifies the specific hash table
- Each field name must be a string
- Values can be arrays, strings, numbers, or booleans
- All field-value pairs are stored in a single database operation
- If the hash table doesn't exist, it will be created automatically
- If any of the fields already exist in the hash table, their values will be overwritten
- More efficient than multiple individual
hashSetId
calls when setting several fields - Player UIDs are commonly used as keys to store player-specific data
- 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