
All checks were successful
Build / Build (push) Successful in 39s
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.
68 lines
2.8 KiB
Markdown
68 lines
2.8 KiB
Markdown
---
|
|
title: ArmaDragonflyClient - Hash Set
|
|
icon: mdi:file-text-outline
|
|
excerpt: Set a field value in the current client's hash table in DragonflyClient.
|
|
---
|
|
|
|
# dragonfly_db_fnc_hashSet
|
|
|
|
## 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
|
|
```sqf
|
|
[_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:
|
|
```sqf
|
|
["loadout", [getUnitLoadout player]] call dragonfly_db_fnc_hashSet;
|
|
```
|
|
|
|
### Store player preferences:
|
|
```sqf
|
|
["settings", [true, 30, "normal"]] call dragonfly_db_fnc_hashSet;
|
|
```
|
|
|
|
### Store data from a client:
|
|
```sqf
|
|
["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 field name 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
|
|
|
|
## Related Functions
|
|
- `dragonfly_db_fnc_hashSetId`: Sets a field value in a specific hash table (when you need to specify the ID)
|
|
- `dragonfly_db_fnc_hashGet`: Retrieves a field value from the current client's hash table
|
|
- `dragonfly_db_fnc_hashGetAll`: Retrieves all fields from the current client's hash table
|
|
- `dragonfly_db_fnc_hashSetBulk`: Sets multiple fields in the current client's hash table
|
|
|
|
## 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) |