Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cba event for cba_fnc_swtichPlayer #305

Merged
merged 2 commits into from
Mar 31, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions addons/common/CfgRemoteExec.hpp

This file was deleted.

7 changes: 7 additions & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,10 @@ if (hasInterface) then {
} count allUnits;
};
};

//Event for switching vehicle var names from CBA_fnc_switchPlayer
["CBA_setVehicleVarName", {
params ["_oldVeh", "_newVeh", "_vehName"];
_oldVeh setVehicleVarName "";
_newVeh setVehicleVarName _vehName;
}] call CBA_fnc_addEventHandler;
1 change: 0 additions & 1 deletion addons/common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class CfgPatches {

#include "CfgEventHandlers.hpp"
#include "CfgFunctions.hpp"
#include "CfgRemoteExec.hpp"
#include "CfgLocationTypes.hpp"

class CBA_DirectCall {
Expand Down
16 changes: 3 additions & 13 deletions addons/common/fnc_switchPlayer.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Parameters:
[type] The type of the new unit the player should switch to [String]

Optional:
[type, "LEAVEWEPS"] - switch to new unit of the given type, but keep
[type, "LEAVEWEAPS"] - switch to new unit of the given type, but keep
the weapons the player had before.


Expand All @@ -23,7 +23,7 @@ Examples:
_h = ["USMC_Soldier_LAT"] spawn CBA_fnc_switchPlayer;

// Switch into a corpsman, but keep the weapons
_h = ["USMC_Soldier_Medic", "LEAVEWEPS"] spawn CBA_fnc_switchPlayer;
_h = ["USMC_Soldier_Medic", "LEAVEWEAPS"] spawn CBA_fnc_switchPlayer;
(end)

Author:
Expand Down Expand Up @@ -64,17 +64,7 @@ LOG(format["3.State transfered, switched player control to new unit, local: %1",
sleep 1;
if (_ar select 7 != "") then
{
if (isMultiplayer) then
{
GVAR(setVehVarName) = compile format ["private['_ou','_nu'];_ou=objectFromNetID(_this select 0);_nu=objectFromNetId(_this select 1);_ou setVehicleVarName'';_nu setVehicleVarName'%1';%1=_nu;", _ar select 7];
publicVariable QGVAR(setVehVarName);
[netId _oldUnit, netId _newUnit] remoteExecCall [QGVAR(setVehVarName)];
}
else
{
_oldUnit setVehicleVarName "";
_newUnit setVehicleVarName (_ar select 7);
};
["CBA_setVehicleVarName", [_oldUnit, _newUnit, (_ar select 7)]] call CBA_fnc_globalEvent;
};

if ("LEAVEWEAPS" in _this) then
Expand Down