ACE3/addons/headless/functions/fnc_endMissionNoPlayers.sqf
jonpas 742626ff1a
General - Relative script_component.hpp includes (#9378)
Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2023-09-12 20:58:10 +02:00

30 lines
723 B
Plaintext

#include "..\script_component.hpp"
/*
* Author: Jonpas
* Ends mission on server if no players are connected.
*
* Arguments:
* None
*
* Return Value:
* None
*
* Example:
* [] call ace_headless_fnc_endMissionNoPlayers
*
* Public: No
*/
// Exit if no players of virtual curators present
if (call CBA_fnc_players isEqualTo [] && {(allCurators select {isPlayer getAssignedCuratorUnit _x}) isEqualTo []}) exitWith {
// End mission
[] call BIS_fnc_endMissionServer;
if (XGVAR(log)) then {
INFO("Ended Mission on all players leaving.");
};
};
// Delay mission end otherwise
GVAR(endMissionCheckDelayed) = false;
TRACE_2("Players are present",count (call CBA_fnc_players),count allCurators);