Skip to main content

Overview

The BanPlayer function allows staff members to ban players temporarily or permanently. All bans are stored in the database with detailed information and can trigger webhook notifications.

BanPlayer

Ban a player for a specified duration with a detailed reason.

Syntax

Parameters

  • staffId (number) - Server ID of the staff member issuing the ban
  • targetId (number) - Server ID of the player to ban
  • duration (number) - Ban duration in seconds (0 for permanent ban)
  • reason (string) - Detailed reason for the ban (minimum 5 characters)

Returns

  • success (boolean) - Whether the ban was successfully issued
  • status (string) - Status code: 'success', 'no_permission', 'player_not_found', 'already_banned', 'invalid_duration', 'invalid_reason'

Example

Duration Helpers

Common ban duration constants for consistency:

Advanced Examples

Progressive Ban System

Ban Appeal System

Scheduled Ban System

Ban Category System

Ban Statistics and Analytics

Error Handling

Handle common scenarios when banning players:
Permanent bans (duration = 0) should be used carefully and only for serious violations. Always document the reason thoroughly.
Implement progressive ban systems and appeal processes to maintain fair moderation while protecting your server from repeat offenders.