K4 - Lottery System

K4-Lottery

A lottery system for Counter-Strike 2 servers where players buy tickets and winners are randomly selected at configurable intervals to receive a percentage of the total pot. Multi-server safe with cryptographically secure winner selection.

Features

Lottery System

  • Buy tickets with in-game currency

  • Configurable ticket price and max tickets per player

  • Automatic draws at scheduled times

  • Configurable winner percentage of pot

  • Cryptographically secure winner selection

Multi-Server Support

  • Safe for multi-server environments with shared database

  • Single draw processing - each draw processed exactly once

  • Race condition protection prevents duplicate processing

  • Shared lottery pool across all connected servers

Player Commands

  • !lottery - Show help and available commands

  • !lottery buy [amount] - Purchase lottery tickets

  • !lottery info - View current lottery info and win chance

  • !lottery top - View all-time top winners leaderboard

  • !lottery history - View recent draw history

Economy Integration

  • Economy plugin integration for ticket purchases

  • Automatic payout to winners (online or offline)

  • Configurable wallet type support

Statistics & History

  • Draw history (last 5 draws preserved)

  • All-time winner statistics tracking

  • Per-player ticket and spending history

  • Top winners leaderboard

Configuration Options

  • DatabaseConnection - Database connection name

  • WalletKind - Economy wallet type to use

  • TicketPrice - Cost per ticket

  • MaxTicketsPerPlayer - Maximum tickets per draw

  • DrawIntervalDays - Days between draws

  • WinnerPercentage - Percentage of pot winner receives

  • DrawTime - Time of day for draw (24h format)

Admin Features

  • Fully configurable via JSON files

  • Custom command aliases

  • Localization support (translations folder)

Author

K4ryuu

Installation

  1. Install SwiftlyS2 on your server

  2. Download the latest release

  3. Extract to swiftlys2/plugins/ directory

  4. Configure config.json and commands.json

  5. Set up database connection in SwiftlyS2

Requirements

  • SwiftlyS2

  • Economy plugin (for ticket purchases and payouts)

  • MySQL/MariaDB, PostgreSQL, or SQLite

Links