# Banning players on a FiveM server

> Ban players on FiveM properly: txAdmin bans with identifiers and hardware IDs, a custom ban table checked in playerConnecting, stopping evasion and appeals.

Source: https://fam-tools.com/guides/fivem-ban-system · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 10 min

**Short answer.** Use txAdmin bans for everyday moderation — they store identifiers and hardware IDs, support durations and are logged with the admin’s name. For automated or shared bans, keep a ban table with every identifier and token, check it in `playerConnecting` with deferrals, match any one of them, and refuse with a message that includes a ban ID and how to appeal.

## Key points

- txAdmin bans: identifiers + hardware IDs, durations, logs.
- Custom bans: store all identifiers and tokens; match any.
- Check in `playerConnecting` with deferrals.
- Always show a ban ID and the appeal route.
- Cfx.re global bans are separate from your server’s bans.

A ban should do three things: keep the player out, survive a new account, and leave a clear record for appeals. txAdmin’s built-in bans cover most servers; a custom system makes sense when bans come from your own anticheat or must be shared between several servers.

## Banning with txAdmin

1. Open the player in txAdmin (online or from the player database).
2. Choose Ban, pick a duration (hours, days, permanent) and write a clear reason.
3. txAdmin stores the player’s identifiers and hardware IDs and refuses matching connections.

Only staff with `players.ban` can ban — see [txAdmin permissions](https://fam-tools.com/guides/txadmin-admins-permissions). Scripts can react to `txAdmin:events:playerBanned` for logging.

## A custom ban check

*server.lua*

```lua
local function collect(src)
    local list = GetPlayerIdentifiers(src)
    for i = 0, GetNumPlayerTokens(src) - 1 do
        list[#list + 1] = GetPlayerToken(src, i)
    end
    return list
end

AddEventHandler('playerConnecting', function(name, setKickReason, deferrals)
    local src = source
    deferrals.defer()
    Wait(0)
    deferrals.update('Checking bans…')

    local ids = collect(src)
    local ban = MySQL.single.await(
        'SELECT b.id, b.reason, b.expires FROM bans b JOIN ban_ids i ON i.ban_id = b.id WHERE i.value IN (?) AND (b.expires IS NULL OR b.expires > NOW()) LIMIT 1',
        { ids }
    )

    if ban then
        deferrals.done(('Banned (#%d): %s. Appeal at discord.gg/yourserver'):format(ban.id, ban.reason))
    else
        deferrals.done()
    end
end)
```

One row per ban and one row per identifier/token keeps the lookup indexed and fast. Identifier types are explained in [player identifiers](https://fam-tools.com/guides/fivem-player-identifiers); deferrals in [connecting cards](https://fivemloadingscreen.pro/guides/fivem-deferrals-connecting-cards).

## Stopping ban evasion

- Match any identifier or token, not all of them.
- When a banned player joins with a new licence but a matching token, add the new identifiers to the same ban.
- Do not rely on IP alone — shared and dynamic IPs cause false bans.

## Ban messages and appeals

A good message states the reason, the expiry (or “permanent”), a ban ID and where to appeal. The ID lets staff find the evidence quickly; logs with screenshots or clips make appeals fair. Staff abuse is prevented by permissions and by logging who banned whom.

## Server bans vs Cfx.re global bans

Your bans only affect your server. Cfx.re can ban accounts platform-wide (for example for cheating); server owners cannot issue or lift those, and players must use Cfx.re support for them.

## Questions

### How do I ban someone on my FiveM server?

In txAdmin, open the player, choose Ban, set a duration and reason. txAdmin blocks their identifiers and hardware IDs.

### How do I stop banned players from coming back?

Ban on all identifiers and player tokens, and match any of them on connect.

### Can I remove a Cfx.re global ban?

No. Global bans are handled by Cfx.re support, not by server owners.

### Should I ban by IP?

Not alone. IPs change and are shared; use them only as one signal among others.

## Related

- https://fam-tools.com/guides/fivem-player-identifiers
- https://fam-tools.com/guides/txadmin-admins-permissions
- https://fam-tools.com/guides/fivem-ace-permissions
- https://fam-tools.com/guides/fivem-sv-pure-level
