Skip to content

bans.list

Returns the server’s address bans that have not expired.

bans.list(): readonly BanRecord[]

None.

An array of ban records, as below. It is a copy: it does not change as bans come and go.

A /bans command.

gamemodes/admin.ts
import { bans, chat, commands } from "nativemp";
commands.register("bans", (player) => {
for (const ban of bans.list()) chat.sendServerMessage(`${ban.id}: ${ban.reason}`, player);
});
Field Type Description
id string The ban’s ID, for bans.remove.
address string The banned network address.
reason string What the player was told.
createdAtUnixSeconds number When it was made, in Unix seconds.
expiresAtUnixSeconds number | null When it ends, in Unix seconds; null for good.