From 903c41308c5023662036b7181117091cd48dc7db Mon Sep 17 00:00:00 2001 From: bux578 Date: Tue, 3 Feb 2015 20:33:15 +0100 Subject: [PATCH] works in singleplayer --- addons/switchunits/XEH_clientInit.sqf | 2 -- addons/switchunits/functions/fnc_initPlayer.sqf | 3 ++- addons/switchunits/functions/fnc_markAiOnMap.sqf | 3 ++- addons/switchunits/functions/fnc_switchUnit.sqf | 5 +++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/addons/switchunits/XEH_clientInit.sqf b/addons/switchunits/XEH_clientInit.sqf index cf6873c14b..dbc239d119 100644 --- a/addons/switchunits/XEH_clientInit.sqf +++ b/addons/switchunits/XEH_clientInit.sqf @@ -25,8 +25,6 @@ if(GVAR(SwitchToEast)) then {_sides pushBack east}; if(GVAR(SwitchToIndependent)) then {_sides pushBack independent}; if(GVAR(SwitchToCivilian)) then {_sides pushBack civilian}; -hint "TEST"; - if (player getVariable ["ACE_CanSwitchUnits", false]) then { [player, _sides] call FUNC(initPlayer); }; diff --git a/addons/switchunits/functions/fnc_initPlayer.sqf b/addons/switchunits/functions/fnc_initPlayer.sqf index f904a460c2..c4e2d19747 100644 --- a/addons/switchunits/functions/fnc_initPlayer.sqf +++ b/addons/switchunits/functions/fnc_initPlayer.sqf @@ -30,7 +30,8 @@ if (vehicle _playerUnit == _playerUnit) then { _playerUnit allowDamage false; GVAR(OriginalUnit) = _playerUnit; - GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); + //GVAR(OriginalName) = [_playerUnit] call EFUNC(common,getName); + GVAR(OriginalName) = name _playerUnit; GVAR(OriginalGroup) = group _playerUnit; // remove all starting gear of a player diff --git a/addons/switchunits/functions/fnc_markAiOnMap.sqf b/addons/switchunits/functions/fnc_markAiOnMap.sqf index c07199dc31..ce7b575398 100644 --- a/addons/switchunits/functions/fnc_markAiOnMap.sqf +++ b/addons/switchunits/functions/fnc_markAiOnMap.sqf @@ -27,6 +27,7 @@ DFUNC(pfhMarkAiOnMap) = { _args = _this select 0; _sides = _args select 0; + // delete markers { deleteMarkerLocal _x; @@ -65,4 +66,4 @@ DFUNC(pfhMarkAiOnMap) = { }; }; -[FUNC(pfhMarkAiOnMap), 1, _sidesToShow] call CBA_fnc_addPerFrameHandler; +[FUNC(pfhMarkAiOnMap), 1.5, [_sidesToShow]] call CBA_fnc_addPerFrameHandler; diff --git a/addons/switchunits/functions/fnc_switchUnit.sqf b/addons/switchunits/functions/fnc_switchUnit.sqf index d5a4f39a4a..abd053ffae 100644 --- a/addons/switchunits/functions/fnc_switchUnit.sqf +++ b/addons/switchunits/functions/fnc_switchUnit.sqf @@ -52,7 +52,6 @@ if (_leave) exitWith { _oldUnit = player; - DFUNC(pfhSwitchUnit) = { private ["_args", "_unit", "_oldUnit", "_respawnEhId", "_oldOwner"]; @@ -61,6 +60,8 @@ DFUNC(pfhSwitchUnit) = { _unit = _args select 0; _oldUnit = _args select 1; + + if (local _unit) exitWith { _oldUnit setVariable [QGVAR(IsPlayerControlled), false, true]; @@ -94,4 +95,4 @@ DFUNC(pfhSwitchUnit) = { }; }; -[FUNC(pfhSwitchBack), 0.2, [_unit, _oldUnit]] call cba_fnc_addPerFrameHandler; +[FUNC(pfhSwitchUnit), 0.2, [_unit, _oldUnit]] call cba_fnc_addPerFrameHandler;