Skip to content

Commit

Permalink
Ignore chat triggers for interactive ban reason (#2067)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Rainyan authored and psychonic committed Jun 22, 2024
1 parent 12dd3f7 commit 363b4b6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion plugins/basebans.sp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 363b4b6

Please sign in to comment.