dragonfly/docs/hash/hashSetId.md
Jacob Schmidt c8d81ba3bb
All checks were successful
Build / Build (push) Successful in 39s
docs: Update README.md with detailed documentation
This commit significantly enhances the `README.md` file, providing comprehensive documentation for the ArmaDragonflyClient.

Key changes:

*   **Detailed Function Categories:** Categorized functions for better organization (Core, Basic Data Operations, Hash Operations, List Operations).
*   **Usage Examples:** Added clear and concise usage examples for basic operations, hash operations (context and ID-specific), and list operations.
*   **Function Documentation Structure:** Outlined the structure for individual function documentation.
*   **License Information:** Updated the license information.
2025-03-30 17:15:35 -05:00

69 lines
2.9 KiB
Markdown

---
title: ArmaDragonflyClient - Hash Set ID
icon: mdi:file-text-outline
excerpt: Set the specified field to the respective value in the hash stored at key from DragonflyClient.
---
# dragonfly_db_fnc_hashSetId
## Description
Sets the value of a specified field in a specific hash table identified by its key. This function allows storing various data types (arrays, strings, numbers, or booleans) in a targeted hash table, making it ideal for player-specific or entity-specific data storage. It provides a way to organize related data under a common identifier.
## Syntax
```sqf
[_key, _keyField, _data] call dragonfly_db_fnc_hashSetId
```
## Parameters
| Parameter | Type | Description | Default |
|-------------|----------------------------------|--------------------------------------------|---------|
| `_key` | String | Identifier of the hash table | "" |
| `_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 under their UID:
```sqf
[getPlayerUID player, "loadout", [getUnitLoadout player]] call dragonfly_db_fnc_hashSetId;
```
### Store vehicle data:
```sqf
["vehicle_123", "status", [true, 100, 75, "active"]] call dragonfly_db_fnc_hashSetId;
```
### Store player data from a client:
```sqf
[getPlayerUID player, "stats", [rank player, score player, name player]] remoteExecCall ["dragonfly_db_fnc_hashSetId", 2, false];
```
## Notes
- Stores a single field-value pair in a specific hash table identified by `_key`
- All three parameters (key, keyField, and data) are required and validated
- If the hash table doesn't exist, it will be created automatically
- If the field already exists in the hash table, its value will be overwritten
- Supports various data types: arrays, strings, numbers, and booleans
- Player UIDs are commonly used as keys to store player-specific data
- Complex data structures should be serialized into arrays
- The operation is executed immediately and synchronously
- All operations are logged for debugging purposes
## Related Functions
- `dragonfly_db_fnc_hashSet`: Sets a field value in the global hash table
- `dragonfly_db_fnc_hashGetId`: Retrieves a field value from a specific hash table
- `dragonfly_db_fnc_hashGetAllId`: Retrieves all fields from a specific hash table
- `dragonfly_db_fnc_hashSetIdBulk`: Sets multiple field-value pairs in multiple hash tables
## Links
[Hash Get](hashGet.md) |
[Hash Get All](hashGetAll.md) |
[Hash Get All ID](hashGetAllId.md) |
[Hash Get ID](hashGetId.md) |
[Hash Set](hashSet.md) |
[Hash Set Bulk](hashSetBulk.md) |
[Hash Set ID](hashSetId.md) |
[Hash Set ID Bulk](hashSetIdBulk.md)