# RedM Loading Screen v2.0.0 Documentation

## RedM Loading Screen Documentation

### Introduction

This script provides an enhanced loading screen experience for your RedM server, integrating features like Discord/Steam user display, customizable music, patch notes, server rules, social media links, and server hints.

## Installation Guide for cas-loadscreenv2

***

### 📦 Step 1: Purchase the Script

* Visit the official Tebex store: [https://cas.tebex.io](https://cas.tebex.io/category/open-source)
* Locate **cas-loadscreenv2** and complete the purchase process.

***

### 📥 Step 2: Download the Resource

* After purchasing, download the ZIP file containing the resource.
* Extract the ZIP file to obtain the `cas-loadscreenv2` folder.

***

### 📤 Step 3: Upload to Server

* Using an FTP client (e.g., FileZilla), upload the `cas-loadscreenv2` folder to your server's `resources/` directory.

***

### ⚙️ Step 4: Enable the Resource

* Open your `server.cfg` file located in the server-data folder.
*   Add the following line to the file:

    ```plaintext
    ensure cas-loadscreenv2
    ```

### Configuration

The primary configuration for this resource resides in `cas-loadscreenv2/config/config.lua`.

```lua
Config = {}

Config.ServerName = "Your Server Name"
Config.ServerLogo = "URL to your server logo"
Config.ServerDescription = "A brief description of your server"

Config.Discord = {
    enabled = true,
    botToken = "YOUR_BOT_TOKEN_HERE",
    guildId = "YOUR_GUILD_ID_HERE", 
    apiUrl = "https://discord.com/api/v10"
}

Config.Steam = {
    enabled = true,
    apiKey = "YOUR_STEAM_API_KEY_HERE", 
    apiUrl = "https://api.steampowered.com"
}

Config.LoadingScreen = {
    defaultSettings = { -- Player-adjustable settings defaults
        clearScreen = false, -- Hides most UI elements except settings button when enabled. Useful for showcasing video backgrounds.
        playMusicOnStartup = true,
        enableMusic = true,
        -- ... other default settings
    },
    music = {
        tracks = { -- Array of music tracks
            {
                id = "1",
                title = "Track Title",
                artist = "Artist Name",
                duration = 240, -- in seconds
                src = "URL to the track",
                albumCover = "URL to the album cover image"
            },
            -- ... more tracks
        }
    },
    patchNotes = { -- Array of patch notes
        {
            id = "1",
            title = "Patch Note Title",
            description = "Patch note description",
            image = "URL to the patch note image",
            date = "YYYY-MM-DD",
            category = "feature" -- or "improvement", etc.
        },
        -- ... more patch notes
    },
  -- ... rules, socialLinks, serverHints, keybinds are configured similarly
}

Config.LoadingEvents = { -- Customize the loading events and messages displayed
    progressMessages = {
        [0] = "Connecting...",
        -- ... other progress messages
    },
    events = {
        ["loadProgress"] = true, -- Whether to show load progress events
        -- ... other events
    }
}

Config.Debug = {
    enabled = false,
    -- ... other debug settings
}

```

### Usage

The loading screen automatically initializes and displays when a player connects. The player's Discord and/or Steam information will be fetched based on their identifiers and the configured API keys. Players can adjust their settings using the settings icon in the top right corner.

### FAQ (Frequently Asked Questions)

* **Q: How do I add more music tracks?**
  * A: Add more objects to the `Config.LoadingScreen.music.tracks` array in `config.lua`.
* **Q: How do I change the background image?**
  * A: Change the `Config.LoadingScreen.defaultSettings.customBackgroundUrl` or use the settings menu in-game.

### Contact/Support

**Need help? Join our Discord support server or contact us through Tebex!**
