Ignore chat triggers for interactive ban reason (#2067)

* Ignore chat triggers for interactive ban reason

If the admin types a chat trigger for a command while BaseBans is
waiting for them to type a ban reason, don't treat that message as the
ban reason.

This fixes a problem where the admin decides to cancel their ban with
"!abortban", "/abortban" etc, but ends up accidentally banning the
player with the ban reason "!abortban" (or by attempting to access any
other command via a chat trigger before typing the ban reason).

* Optimize

Check if we're actually waiting for chat reason before calling the native
This commit is contained in:
Rain 2023-10-16 17:43:00 +00:00 committed by GitHub
parent 2c6ef5825f
commit 8938a29904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -384,7 +384,7 @@ public Action Command_AbortBan(int client, int args)
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
{
if(playerinfo[client].isWaitingForChatReason)
if(playerinfo[client].isWaitingForChatReason && !IsChatTrigger())
{
playerinfo[client].isWaitingForChatReason = false;
PrepareBan(client, playerinfo[client].banTarget, playerinfo[client].banTime, sArgs);