Player names are the one piece of text every visitor controls, and on a public server a fraction of them will abuse it: a website advert as a clan tag, a slur, a name that impersonates an admin, or an empty/blank nick that breaks kill feeds. The engine gives you almost nothing here, so name moderation is an AMX Mod X job. This covers what the engine does at connect, what a name filter can enforce, and how to apply it without breaking legitimate name changes.
1. Understand when a name is set
A client's name is the name setinfo value. It is sent at connect and can be changed at any time in-game via the console (name "whatever") or the options menu. That means a filter cannot be a one-time check at join — a player can connect with a clean name and switch to www.rival-server.com ten seconds later. Any real solution has to react to name changes, not just connects.
2. What the engine and mp_ cvars can do (not much)
Stock CS has no name blacklist. The engine will reject a name that is entirely empty by substituting a default, and it collapses some characters, but there is no cvar to ban a word or a URL from a nick. Do not go looking for an mp_ cvar for this — it does not exist. This is squarely a plugin problem, which is why every serious public server runs a name filter.
3. How an AMXX name filter works
A name-filter plugin hooks the moment a name is set and validates it, using the client_infochanged forward (fired whenever any setinfo, including name, changes) and the namecheck/SetClientKeyValue mechanics to inspect and, if needed, overwrite the new name. The logic is:
- Read the proposed new name from the client's info buffer.
- Compare it against a blacklist (substrings, or a regex for URLs) and against structural rules (min length, no all-whitespace, character set).
- If it violates a rule, reject it — either revert to the previous name or force a neutral placeholder like
Player, and optionally warn the client.
Blocking a URL pattern such as .com, .net, www. and http catches the overwhelming majority of name adverts. A short slur list handles the rest. Our CSB Name Filter implements exactly this — a configurable blacklist plus URL and empty-name rules that rename offenders on the spot.
4. Set sensible rules
Filters that are too aggressive punish normal players. Reasonable defaults:
- Block URLs —
www.,http, and common TLDs in a name are almost always ads. This is the single highest-value rule. - Reject empty / whitespace-only names — force a placeholder. Blank names break the kill feed and votes.
- Minimum length — one or two characters is usually a troll or an evasion; require at least three.
- Impersonation — block names containing
ADMIN, your server name, or an owner's handle, so nobody masquerades as staff. - Slur list — keep it short and specific; long word lists cause false positives on innocent substrings (the classic \"Scunthorpe\" problem).
Log every rename so you can tune the list and catch a rule that fires too often.
5. Handle the rename gracefully
When you reject a name, tell the player why and give them a clean fallback rather than silently reverting in a loop — a client whose name is rejected can get stuck re-sending it. Print a one-line chat message (\"Names with website addresses are not allowed\") and set them to a neutral placeholder. Pair the filter with an adverts plugin that states the naming rule occasionally, so it feels like a policy rather than a random kick.
Common errors
- Filter only checks at connect, ads slip in later — it hooks connect instead of
client_infochanged. A name changed in-game must be re-validated. - Legitimate names get rejected — an over-broad blacklist (a TLD substring matching inside a normal word, or a slur substring inside an innocent one). Match on word boundaries or full tokens, not bare substrings.
- Name-change loop — the plugin reverts to the same rejected value the client keeps resending. Force a fixed placeholder instead of bouncing between two names.
- Unicode/colored names bypass the filter — the offender uses lookalike characters. Normalize the string before matching, or block non-ASCII if your community does not need it.
- Admins caught by the impersonation rule — exempt authenticated admins from the
ADMINblock by checking their flags before filtering.
Verification
Test each rule from a client console. Try to set a forbidden name and confirm the plugin corrects it:
name "www.some-ad.com" // should be rejected / renamed name "" // should become a placeholder name "x" // should fail the minimum-length rule
Watch the server console or AMXX log for the rename entries. Then set a perfectly normal name and confirm it is accepted unchanged — a filter that blocks ads but also blocks Steve is worse than no filter. Once it behaves, add the naming rule to your MOTD so players know before they are corrected.









