/*
* Important!
* There is a small window were "isPlayer xxx" yields true on a dedicated, but
* "local xxx" on the server ALSO yields true. The player object stays on the server
* until the client has connected. The below makes sure that this script doesn't continue
* on the client's machine until the player is connected correctly.
*/
if (!isDedicated) then
{
  waitUntil {!(isNull player)};
  waitUntil {alive player};
};
/*
* Initialize the loadouts
* This array contains all my loadout scripts in the order that units appear in the mission.
* You can use other methods to determine a loadout, like class
*/
_loadouts = [
  "loadouts\ksk_tl.sqf",
  "loadouts\ksk_ar.sqf",
  "loadouts\ksk_sniper.sqf",
  "loadouts\ksk_at.sqf",
  "loadouts\ksk_medic.sqf",
  "loadouts\ksk_tl.sqf",
  "loadouts\ksk_ar.sqf",
  "loadouts\ksk_sab.sqf",
  "loadouts\ksk_gren.sqf",
  "loadouts\ksk_medic.sqf"
];
/*
* FHQ_fnc_safeAddLoadout is a function in the function module I use for every
* mission. See below
*/
{
  if (local _x) then {
    _loadout = _loadouts select _forEachIndex;
    [_x, _loadout] call FHQ_fnc_safeAddLoadout;
  };
} foreach playableUnits;