Skip to content

CommandListener documentation LIES about Plugin_Handled #1363

@rtldg

Description

@rtldg

Help us help you

  • I have checked that my issue doesn't exist yet.
  • I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
  • I can always reproduce the issue with the provided description below.

Environment

  • Operating System version: Windows
  • Game/AppID (with version if applicable): 232330 (Counter-Strike: Source Dedicated Server)
  • Current SourceMod version: 1.10.0.6492
  • Current SourceMod snapshot: 1.11.0.6633
  • Current Metamod: Source snapshot: 971:6c8495f

Description

The documentation for the CommandListener callback says
Returning Plugin_Handled or Plugin_Stop will prevent the original, baseline code from running.
In my test code it seems to only block when returning Plugin_Stop.
I think the check is here
Is this a documentation issue or an implementation issue?

Problematic Code (or Steps to Reproduce)

#include <sourcemod>

public void OnPluginStart()
{
  AddCommandListener(CommandListener_Noclip, "sm_noclip");
}

Action CommandListener_Noclip(int client, const char[] command, int argc)
{
  if (IsPlayerAlive(client) && argc < 1) {
  	ReplyToCommand(client, "[SM] aaaa");
  	return Plugin_Handled;
  }
  return Plugin_Continue;
}

With the funcommands plugin loaded, run sm_noclip

Logs

Console output is:

] sm_noclip
[SM] aaaa
[SM] Usage: sm_noclip <#userid|name>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Buggeneral bugs; can be anythingDocumentationa change only towards documentationGood First IssueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions