> For the complete documentation index, see [llms.txt](https://freilichtbuehne.gitbook.io/nova-defender/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://freilichtbuehne.gitbook.io/nova-defender/lua-api-deprecated/ban-system.md).

# Ban System

sWatch takes extra meassures befor banning a player.

## Hooks

<details>

<summary>swatch_banbypass_onplayerban</summary>

Called whenever a player gets banned. If player is online, there will be a delay after this hook has been called to still interact with him for a short time.

#### Arguments

1. **(String)** steamID32
2. **(Table)** banDetails
3. **(Boolean)** onlineBan - `true` if player is online, `false` if player is offline

</details>

<details>

<summary>swatch_banbypass_cookieloaded</summary>

Called when server finished deciding/checking if a player should get a device cookie. From there we can tell if player is trusted or not.

#### Arguments

1. **(Player)** player

</details>

<details>

<summary>swatch_banbypass_check</summary>

Called when sWatch checks if player is bypassing a ban. You can implement you own checks at any time, but this is the recommended timespan.

#### Arguments

1. **(Player)** player

</details>

## Functions

{% hint style="info" %}
If a ban is in progress, the player is imune to kicks or bans with other reasons.
{% endhint %}

<details>

<summary>sWatch.banPlayer</summary>

Used to ban a online or offline player.&#x20;

\
**Player is offline:** Offline player will be set to banned on sight. The next time the player enters the server he will be banned.

**Player is online:** We send different payloads to the client and after some seconds he will get banned.

#### Arguments

1. **(Player|SteamID)** player
2. **(String)** reason - Displayed to the banned client (leave empty for default reason)
3. **(String)** comment - Add some details to the ban. Will only be visible for admins in the menu.
4. **(String)** internalReason - use `"admin_manual"` or create a new detection in `config/detections.lua` file. If no internal reason is given, an error will occur.
5. **(Boolean)** force (optional) - ignores if detection is disabled or invalid

#### Example

```lua
sWatch.banPlayer(
    "STEAM_0:1:1234567", 
    "Please just go", // Reason to display client
    "I didn't like him", // Internal comment
    "admin_manual"
)
```

</details>

<details>

<summary>sWatch.unbanPlayer</summary>

Player will bet set to unban on sight and unbanned as soon as he joins the server. Can be reverted by banning him again.

#### Arguments

1. **(SteamID)** playerSteamID

</details>

<details>

<summary>sWatch.kickPlayer</summary>

#### Arguments

1. **(Player|SteamID|SteamID64)** player
2. **(String)** reason - Displayed to the client (leave empty for default reason)
3. **(String)** internalReason - Same as `internalReason` in [#swatch.banplayer](#swatch.banplayer "mention")

</details>

<details>

<summary>sWatch.isPlayerBanned</summary>

Check if a player was banned by sWatch

#### Arguments

1. **(SteamID|SteamID64|Player)** player

#### Returns

1. **(Boolean)** isBanned

</details>

<details>

<summary>sWatch.getAllBans</summary>

Get full table of all bans made by sWatch

#### Returns

1. **(Table)** bans

</details>

<details>

<summary>sWatch.isFamilyShared</summary>

#### Arguments

1. **(Player)** player

#### Returns

1. **(Boolean)** isFamilyShared

</details>

<details>

<summary>sWatch.isOwnerBanned</summary>

Check if the family sharing owner of this Garry’s Mod is banned by sWatch

#### Arguments

1. **(Player)** player

#### Returns

1. **(Boolean)** isOwnerBanned

</details>

<details>

<summary>sWatch.playerHasCookie</summary>

Used internal. Equals to [/pages/Fl7ySxPk22HoVGdo6X8G#swatch.istrusted](https://freilichtbuehne.gitbook.io/nova-defender/lua-api-deprecated/pages/Fl7ySxPk22HoVGdo6X8G#swatch.istrusted "mention").

#### Arguments

1. **(Player)** player

#### Returns

1. **(Boolean)** hasCookie

</details>

<details>

<summary>sWatch.getFingerprint</summary>

A Fingerprint is collected from every client. If a player gets banned, his fingerprint will get stored together with the ban to prevent a bypass. Fingerprint will get requested from client on `swatch_networking_playerauthenticated` and is avaliable after a few seconds.

#### Arguments

1. **(Player|SteamID|SteamID64)** player

#### Returns

1. **(Table)** fingerprint

</details>

<details>

<summary>sWatch.getIndicators</summary>

Like [#swatch.getfingerprint](#swatch.getfingerprint "mention")we collect typical indicators on players. (Newly installed game, use of developer commands, ...)

#### Arguments

1. **(Player|SteamID|SteamID64)** player

#### Retruns

1. **(Table)** indicators

</details>
