diff --git a/addons/spectator/XEH_postInit.sqf b/addons/spectator/XEH_postInit.sqf index b57d08ac7b..04c9737664 100644 --- a/addons/spectator/XEH_postInit.sqf +++ b/addons/spectator/XEH_postInit.sqf @@ -7,7 +7,7 @@ ["SettingsInitialized", { if !GVAR(enabled) exitWith {}; - + //check if respawn is set up properly _fail = if (getNumber (missionConfigFile >> "respawn") != 3 && getText (missionConfigFile >> "respawn") != "Base") then {true} else {false}; if (_fail) exitWith { @@ -15,8 +15,8 @@ systemChat _text; diag_log text _text; }; - - if GVAR(endMission) then { + + if (GVAR(endMission) && isServer) then { [{ if (player distance GVAR(penPos) < 200) then { if ({isPlayer _x && alive _x && (_x distance GVAR(penPos)) > 200} count allUnits == 0) then { @@ -26,27 +26,18 @@ }; }, 2] call CBA_fnc_addPerFrameHandler; }; - - if (isDedicated) exitWith {}; - + + if !(hasInterface) exitWith {}; + call FUNC(penPos); - { - if (getMarkerPos _x isEqualTo [0,0,0]) then { - _marker = createMarkerLocal [_x, [0,0]]; - _marker setMarkerShapeLocal "ICON"; - }; - - _x setMarkerPosLocal GVAR(penPos); - } forEach ["respawn_west", "respawn_east", "respawn_guerrila", "respawn_civilian"]; - GVAR(playerSide) = side (group player); - + if GVAR(tracking) then { [FUNC(checkUnits), 2] call CBA_fnc_addPerFrameHandler; [FUNC(trackUnits), 20] call CBA_fnc_addPerFrameHandler; }; - + player addEventHandler ["Killed", { [player] joinSilent grpNull; if (isClass (configFile >> "CfgPatches" >> "ace_hearing")) then {EGVAR(hearing,disableVolumeUpdate) = true}; @@ -60,7 +51,7 @@ if (isClass (configFile >> "CfgPatches" >> "ace_hearing")) then {EGVAR(hearing,disableVolumeUpdate) = true}; if (isClass (configFile >> "CfgPatches" >> "acre_sys_radio")) then {[true] call acre_api_fnc_setSpectator}; if (isClass (configFile >> "CfgPatches" >> "task_force_radio")) then {[player, true] call TFAR_fnc_forceSpectator}; - + if !GVAR(modulePos) then { _corpse = _this select 1; if (!isNil "_corpse") then { @@ -69,7 +60,7 @@ }; }; }; - + player addEventHandler ["HandleDamage", {0}]; [player] joinSilent grpNull; removeAllWeapons player; @@ -80,17 +71,17 @@ player linkItem "ItemMap"; player linkItem "ItemRadio"; hideObjectGlobal player; - + if (surfaceisWater GVAR(penPos)) then { player forceAddUniform "U_B_Wetsuit"; player addVest "V_RebreatherB"; }; - + player setPosATL GVAR(penPos); - + 0 fadeSound 0; 999999 cutText ["", "BLACK FADED", 0]; ["Init", [true]] call FUNC(camera); }]; -}] call EFUNC(common,addEventHandler); \ No newline at end of file +}] call EFUNC(common,addEventHandler);