Skip to content
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
1 change: 1 addition & 0 deletions addons/common/XEH_postInit.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ if (isServer) then {
[QGVAR(createZeus), {call FUNC(createZeus)}] call CBA_fnc_addEventHandler;

missionNamespace setVariable [QGVAR(allowChatMessages), true, true];
missionNamespace setVariable [QGVAR(chatSlowMode), 0, true];
};

if (isDedicated) then {
Expand Down
2 changes: 2 additions & 0 deletions addons/common/XEH_postInitClient.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

if (!hasInterface) exitWith {};

GVAR(allowNextMessageTime) = -1;

[missionNamespace, "arsenalOpened", {
disableSerialization;
params [["_display", displayNull]];
Expand Down
24 changes: 24 additions & 0 deletions addons/common/commands_admins.inc.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,27 @@
[QGVAR(chatMessage), [profileName, format ["Side/Global chat has been %1!", ["unlocked", "locked"] select _disable], "", "", true]] call CBA_fnc_globalEvent;
}, "Disable/enable all player chat messages in global and side chat. 0 enable weapons, 1 disable weapons. <#fp.chatlock 0/1>"] call FUNC(registerChatCommand);
} forEach ["cl", "chatlock"];

{
[_x, {
params [["_str", ""]];
if (_str isEqualTo "") exitWith {
systemChat "You need to provide some number in seconds...";
};
private _number = parseNumber _str;
if (isNil "_number") exitWith {
systemChat format ["'%1' is not a valid number, chief!", _str];
playSound "3DEN_notificationWarning";
};

_number = (round _number) max 0;
missionNamespace setVariable [QGVAR(chatSlowMode), _number, true];
missionNamespace setVariable [QGVAR(allowNextMessageTime), -1, true];

if (_number > 0) then {
[QGVAR(chatMessage), [profileName, format ["Chat has been put into slow mode! Currently %1 seconds", _number], "", "", true]] call CBA_fnc_globalEvent;
} else {
[QGVAR(chatMessage), [profileName, "Chat slow mode has been disabled!", "", "", true]] call CBA_fnc_globalEvent;
};
}, "Puts side/global chat into slow mode. Any number > 0 will enable slow mode. Number is in seconds. Setting the number to 0 will disable slow mode. <#fp.slowmode 0/1>"] call FUNC(registerChatCommand);
} forEach ["sm", "slowmode"];
31 changes: 26 additions & 5 deletions addons/common/functions/fnc_handleChatMessage.sqf
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
#include "script_component.hpp"
params [["_channel", -1], "", "", "", ["_person", objNull]];

if (GVAR(allowChatMessages) || {!(_channel in [0,1])}) exitWith {false};
// Allow admins to always send messages
// Allow sending in vehicle, group, direct, command channels
if (!(_channel in [0, 1]) || isNull _person || {call FUNC(isAdmin)}) exitWith {false};

@diwako diwako Mar 29, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be discussed if admins should bypass this or not


if (_person isEqualTo ace_player) then {
systemChat "Messages into global and side chat have been locked! Use whispers if you need to contact zeus or an admin!";
playSound "3DEN_notificationWarning";
private _ret = false;

if !(GVAR(allowChatMessages)) then {
if (_person isEqualTo ace_player) then {
systemChat "Messages into global and side chat have been locked! Use whispers if you need to contact zeus or an admin!";
playSound "3DEN_notificationWarning";
_ret = true;
};
};

if (!_ret && GVAR(chatSlowMode) > 0) then {
if (GVAR(allowNextMessageTime) > time) then {
systemChat format ["Chat is in slow mode! You can send your next message in %1 seconds!", round (GVAR(allowNextMessageTime) - time)];
playSound "3DEN_notificationWarning";
_ret = true;
} else {
GVAR(allowNextMessageTime) = time + GVAR(chatSlowMode);
// make sure this text appear below your message and not above it
[{
systemChat format ["You can send your next message in %1 seconds!", GVAR(chatSlowMode)];
}] call CBA_fnc_execNextFrame;
};
};

true
_ret
Loading