ramdb/docs/hash/hashSetId.md
Jacob Schmidt 8c0e8144e5 docs: Update documentation links and function references
This commit updates the documentation to reflect the current function names and link structure. Specifically, it addresses the following:

*   Corrected internal links within the documentation to point to the correct markdown files (e.g., `hashDelete.md` instead of `hashDelete`).
*   Updated related function references to reflect the current function names and include missing functions.
*   Removed outdated function references.
*   Added `ramdb_db_fnc_scheduler` to related functions where appropriate.
*   Updated the links section to use the correct markdown file names.
2025-03-22 16:53:30 -05:00

74 lines
3.0 KiB
Markdown

---
title: ArmaRAMDb - Hash Set ID
icon: mdi:file-text-outline
excerpt: Set the specified field to the respective value in the hash stored at key from RAMDb.
---
# ramdb_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 ramdb_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 ramdb_db_fnc_hashSetId;
```
### Store vehicle data:
```sqf
["vehicle_123", "status", [true, 100, 75, "active"]] call ramdb_db_fnc_hashSetId;
```
### Store player data from a client:
```sqf
[getPlayerUID player, "stats", [rank player, score player, name player]] remoteExecCall ["ramdb_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
- `ramdb_db_fnc_hashSet`: Sets a field value in the global hash table
- `ramdb_db_fnc_hashGetId`: Retrieves a field value from a specific hash table
- `ramdb_db_fnc_hashGetAllId`: Retrieves all fields from a specific hash table
- `ramdb_db_fnc_hashSetIdBulk`: Sets multiple field-value pairs in multiple hash tables
- `ramdb_db_fnc_hashDeleteId`: Removes a specific hash table
## Links
[Hash Delete](hashDelete.md) |
[Hash Delete ID](hashDeleteId.md) |
[Hash Get](hashGet.md) |
[Hash Get All](hashGetAll.md) |
[Hash Get All ID](hashGetAllId.md) |
[Hash Get ID](hashGetId.md) |
[Hash Remove](hashRemove.md) |
[Hash Remove ID](hashRemoveId.md) |
[Hash Set](hashSet.md) |
[Hash Set Bulk](hashSetBulk.md) |
[Hash Set ID](hashSetId.md) |
[Hash Set ID Bulk](hashSetIdBulk.md)