ArmaDragonflyClient - Add Task

Add Task

Description

Adds a task to the database operation queue. This function is used to schedule database operations that can be processed sequentially, providing a way to manage multiple database requests in an organized manner.

Syntax

[_taskType, _key, _keyField, _index, _value, _function, _call, _netId] call dragonfly_db_fnc_addTask

Parameters

ParameterTypeDescriptionDefault
_taskTypeStringType of operation to perform (e.g., "hgetall")""
_keyStringName of the stored key""
_keyFieldStringField name for hash operations""
_indexNumberIndex for list operations-1
_valueArray, String, Number, or BooleanValue to store (for set operations)
_functionStringName of function to call with the result""
_callBooleanWhether to call the function directly (true) or spawn (false)false
_netIdStringNetID of the target to receive the resultnil

Return Value

None. The task is added to the queue and processed asynchronously.

Examples

Add a hash table retrieval task:

["hgetall", "", "", -1, [], "dragonfly_db_fnc_test"] call dragonfly_db_fnc_addTask;

Add a player-specific task that returns data to a specific client:

["hgetallid", getPlayerUID player, "", -1, [], "dragonfly_db_fnc_test", false, netId player] remoteExecCall ["dragonfly_db_fnc_addTask", 2, false];

Add a list operation task:

["listadd", "playerMessages", "", -1, ["New message content"], ""] call dragonfly_db_fnc_addTask;

Notes

  • Tasks are processed in the order they are added to the queue
  • If the queue is not currently being processed, this function will start the processing
  • The task type determines which database operation will be performed
  • This function is particularly useful for scheduling multiple related operations
  • All operations performed through the task queue are logged for debugging

Add Task | Handler | Init | Process Queue | Scheduler | Setup