Files
MissionTemplate/framework/client/functions/fn_bindEventHandlers.sqf
2024-02-06 01:52:25 -08:00

58 lines
1.7 KiB
Plaintext

#include "..\script_component.hpp"
if ( !hasInterface ) exitWith {};
player addEventHandler["Respawn",
{
params ["_unit", "_corpse"];
private _killer = _corpse getVariable ["ace_medical_causeOfDeath", "#scripted"];
if (_killer == "respawn_button") then {
[
LEVEL_INFO
QUOTE(COMPONENT),
"RESPAWNED WHILE UNCONSCIOUS",
[_unit] call EFUNC(common,addPlayerInfoToArray)
] remoteExec [QEFUNC(common,log), 2];
// format["%1 was unconscious then clicked the respawn button", name _unit] remoteExec["systemChat", 0];
};
}
];
[
{
params ["_unit", "_object", "_cost"];
private _return = (count nearestObjects [_unit, ["B_APC_Tracked_01_CRV_F", "rhsusf_M1239_M2_Deploy_socom_d", "rhsusf_stryker_m1132_m2_wd", "rhsusf_m113_usarmy_supply", "rhsusf_M1078A1P2_B_WD_CP_fmtv_usarmy", "B_Slingload_01_Cargo_F"], 120]) > 0;
_return
}
] call ace_fortify_fnc_addDeployHandler;
addMissionEventHandler ["HandleChatMessage",
{
params ["_channel", "_owner", "_from", "_text", "_person", "_name", "_strID", "_forcedDisplay", "_isPlayerMessage", "_sentenceType", "_chatMessageType"];
if ( missionNamespace getVariable ["milsim_sideChat", false] ) exitWith{ false };
if (_channel != 1) exitWith { false };
if ( ( admin _owner ) != 0 ) exitWith { false };
if ( !isNull ( getAssignedCuratorLogic _person ) ) exitWith { false };
true;
}
];
["ace_arsenal_displayClosed", {
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2];
}] call CBA_fnc_addEventHandler;
[missionNamespace, "arsenalClosed", {
[player] remoteExec [QEFUNC(common,logPlayerInventory), 2];
}] call BIS_fnc_addScriptedEventHandler;
diag_log text "[MILSIM] (client) event handlers bound";
nil;