Scripted Event Handlers - CBATeam/CBA_A3 GitHub Wiki

This is a list of usable Custom Events executed by CBA_A3 itself.


Event: CBA_SettingChanged

Description:

An addon setting was changed either locally or was overwritten by the server.

Example:

["CBA_SettingChanged", {
    params ["_settingName", "_newSettingValue"];
    systemChat format ["Setting: %1 is now: %2", _settingName, _newSettingValue];
}] call CBA_fnc_addEventHandler;

Event: CBA_loadingScreenDone

Description:

The initial mission loading screen is completed and the player has control over their avatar.
Full Documentation

Example:

// init.sqf
["CBA_loadingScreenDone", {
    hint "You're now in control!";
}] call CBA_fnc_addEventHandler;

Event: cba_events_chatMessageSent

Description:

Local player sent a chat message. Channel can be retrieved using currentChannel.

Example:

// init.sqf 
// play sound notification for incoming chat messages
["cba_events_chatMessageSent", {
    // ignore chat commands
    params ["_message"];
    if (_message select [0,1] == "#") exitWith {};

    private _targets = [];

    switch (currentChannel) do {
        case 0: { // global channel
            _targets = 0; // everyone
        };
        case 1: { // side channel
            _targets = playerSide;
        };
        case 2: { // command channel
            _targets = allGroups select {side _x == playerSide} apply {leader _x};
        };
        case 3: { // group channel
            _targets = units player;
        };
        case 4: { // vehicle channel
            _targets = crew cameraOn;
        };
        case 5: { // direct channel
            _targets = allPlayers select {_x distance player <= 40};
        }; 
    };

    "Beep_Target" remoteExec ["playSound", _targets];
}] call CBA_fnc_addEventHandler;