Skip to content

Name Filter

Person8880 edited this page Nov 4, 2023 · 8 revisions

Overview

The name filter plugin allows you to specify certain names that should be restricted to one player only. This can help to stop someone impersonating an admin while there are no real admins present.

For an explanation of the pattern syntax see here: http://lua-users.org/wiki/PatternsTutorial

You do not have to use patterns. You can set a filter to be a plain text match by adding "PlainText": true.

Config

The config looks something like this:

{
    "BanLength": 1440,
    "Filters": [
    	{ "Pattern": "person(8+)0", "Excluded": "123456" },
        { "Pattern": "MyAwesomeName", "Excluded": "654321", "PlainText": true }
    ],
    "FilterAction": "RENAME",
    "ForcedNames": {
        "123": "NSPlayer123"
    },
    "__Version": "1.2"
}

The file should be called “NameFilter.json” and should be placed in the directory defined as your plugin config directory (default is config://shine/plugins).

Option Description
Filters A list of patterns to check for in player names (see below).
FilterAction There are 3 available actions:
  • RENAME will rename the player to a variant of NSPlayerYYYY.
  • KICK will kick the player.
  • BAN will ban the player.
BanLength If FilterAction is set to BAN, then this is the time in minutes the player will be banned for a filtered name match. Set to 0 for permanent.
ForcedNames Any player whose NS2 ID is contained in this table will have their name forced to the name provided.

Filters

Filters have the following fields:

Field Description Example
Pattern The pattern to check for in player names. "Pattern": "person(8+)0"
Excluded An optional NS2ID or set of NS2 IDs to exclude from this pattern (i.e. the player(s) that own the name). "Excluded": "123456"
PlainText An optional flag indicating whether the pattern should be matched as plain text. Setting to true will disable the use of Lua pattern matching and match only if a player name contains the exact string provided. "PlainText": true

Exclusions

Exclusions can be either a single NS2 ID, or a set of NS2 IDs. For example:

{
    "Filters": [
        {
            "Pattern": "example-1",
            // This excludes just the player with NS2 ID "123456".
            "Excluded": "123456"
        },
        {
            "Pattern": "example-2",
            // This excludes both "123456" and "987654".
            "Excluded": [ "123456", "987654" ]
        },
        {
            "Pattern": "example-3",
            // This is equivalent to the previous filter's exclusions.
            "Excluded": {
                "123456": true,
                "987654": true
            }
        }
    ]
}

Console commands

Command Chat Command Arguments Description
sh_rename !rename <player> <new name> Renames the given player.
sh_renameid !renameid <steamid> <new name> Renames the given Steam ID permanently.
sh_unrenameid !unrenameid <steamid> Removes any stored rename for the given Steam ID.
Clone this wiki locally