client/addons/task/functions/fnc_handler.sqf
2025-01-05 17:00:03 -06:00

63 lines
1.6 KiB
Plaintext

#include "..\script_component.hpp"
/*
* Author: Creedcoder, J. Schmidt
* Server side task handler/spawner.
*
* Arguments:
* 0: Type of task <STRING>
* 1: Params for task <ARRAY>
* 2: Minimum rating for task <NUMBER> (default: nil)
*
* Return Value:
* None
*
* Example:
* ["task_type", [_reward, _punish, _time, etc.....], minRating] remoteExec ["forge_client_task_fnc_handler", 2, false];
*
* Public: Yes
*/
params [["_taskType", "", [""]], ["_cntParams", [], [[]]], ["_minRating", 0, [0]]];
private _thread = 0;
GVAR(acceptTask) = false;
if (isNil "companyRating") then { companyRating = 0; };
if (isNil "_minRating") then { _minRating = 0; };
private _companyRating = companyRating;
if (_companyRating < _minRating) exitWith {
hint format ["The company rating of %1 does not meet or exceed the minimum required rating of %2.", _companyRating, _minRating];
};
switch (_taskType) do {
case "attack": {
private _thread = _cntParams spawn FUNC(attack);
waitUntil { sleep 2; scriptDone _thread };
};
case "defuse": {
private _thread = _cntParams spawn FUNC(defuse);
waitUntil { sleep 2; scriptDone _thread };
};
case "destroy": {
private _thread = _cntParams spawn FUNC(destroy);
waitUntil { sleep 2; scriptDone _thread };
};
case "hostage": {
private _thread = _cntParams spawn FUNC(hostage);
waitUntil { sleep 2; scriptDone _thread };
};
case "hvt": {
private _thread = _cntParams spawn FUNC(hvt);
waitUntil { sleep 2; scriptDone _thread };
};
default {
diag_log format ["Unknown Contract Type: %1", _taskType];
};
};
diag_log "Mision Handler Done";
GVAR(acceptTask) = true;