Spatsiba 89 Posted October 3, 2018 (edited) Hey! If I want to add eventHandlers to: EDIT: class CfgVehicles { class Man; class CAManBase: Man { class EventHandlers { addEventHandler ["GetInMan", {[player] call Salmon_fnc_function}]; addEventHandler ["GetOutMan", {[player] call Salmon_fnc_function}] }; }; }; How would I go about doing that? I want to call a function every time a player with the mod loaded gets in or out of a vehicle. Edited October 3, 2018 by Spatsiba Found some more info Share this post Link to post Share on other sites
Noks - Ohliger 4 Posted October 4, 2018 There are 3 ways to do this in vanilla (at least I am thinking of 3 ways) the EventHandlers class (what you tried) class CfgVehicles { class Man; class CAManBase: Man { class EventHandlers { GetInMan = "(_this select 0) call Salmon_fnc_function"; GetOutMan = "(_this select 0) call Salmon_fnc_function"; }; }; }; the cfgFunction class class CfgFunctions { class Salmon { tag = "Salmon"; class SalmonFuntions { file = "Salmon\functions"; class function // you will be able to call this function by the name "Salmon_fnc_function" { postinit = 1; // if postinit is set to 1, the function will not be executed at the initialization of the game but at the initialization of your mission recompile = 0; // do not allow recompile }; }; }; }; the initPlayerLocal.sqf script file inside of your mission folder player addEventHandler [ "GetInMan", { _vehIn = [player] call "Salmon\functions\fn_function.sqf"; } ]; player addEventHandler [ "GetOutMan", { _vehOut = [player] call "Salmon\functions\fn_function.sqf"; } ]; 1 Share this post Link to post Share on other sites
Larrow 2823 Posted October 5, 2018 config.cpp class CfgPatches { class test_manEH { units[] = {}; requiredVersion = 1.0; requiredAddons[] = {"A3_Characters_F"}; }; }; class CfgVehicles { class Man; class CAManBase: Man { class EventHandlers { GetInMan = "( _this + [ 'in' ] ) call Salmon_fnc_function"; GetOutMan = "( _this + [ 'out of' ] ) call Salmon_fnc_function"; }; }; }; class CfgFunctions { class test_manEH { tag = "Salmon"; class test_manEH { //LARs << as this is my base folder I pack from, change to suit //test_manEH << as this is the name of the folder containing the files that was packed file = "LARs\test_manEH\functions"; class function {}; }; }; }; test_manEH\functions\fn_function.sqf //Top of Salmon_fnc_function params[ "_unit", "_position", "_vehicle", "_turretPath", "_action" ]; if !( _unit isEqualTo player ) exitWith {}; //If we get here we must be the local client //Send hint to everyone for testing, so we can see server sontrolled AI are not producing hint format[ "%1 got %2 %3", name _unit, _action, getText( configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayName" ) ] remoteExec [ "Hint", 0 ]; TEST_ADDON 2 Share this post Link to post Share on other sites
Spatsiba 89 Posted October 7, 2018 Thanks for the help! I got it working! :) Share this post Link to post Share on other sites