Skip to main content

LB Scripts Integration

To use sCloud with LB-Phone or LB-Tablet, you need to configure the scripts to use custom upload method. If you use both scripts or have multiple FiveM servers, we recommend you to either use different buckets or organize your files in a specific folder.
sCloud CDN provides a custom bucket type made for LB-Scripts, when creating your bucket, select LB-Scripts as the bucket type.This ensure that your bucket and our API are optimized for LB-Scripts and your players.

Configuration

First, you need to create a bucket if not already done, you can do so by heading to sCloud CDN Dashboard. Use the following details to configure the custom upload method:
  • Upload URL: https://cdn.sacul.cloud/YOUR_BUCKET_NAME
  • Field Name: file
  • Headers:
    • Authorization: Bearer YOUR_API_KEY
Replace YOUR_BUCKET_NAME and YOUR_API_KEY with your actual sCloud credentials. You can find your API key in your sCloud CDN Dashboard.

LB-Phone Configuration

First, open the main LB-Phone configuration file in lb-phone/config/config.lua and scroll down to Config.UploadMethod to set the following values.
Config.UploadMethod.Video = "Custom"
Config.UploadMethod.Image = "Custom"
Config.UploadMethod.Audio = "Custom"
Optionnaly, you can edit the following configuration
Config.Video = {}
Config.Video.Bitrate = 500
Config.Video.FrameRate = 24
Config.Video.MaxSize = 50
Config.Video.MaxDuration = 120

Config.Image = {}
Config.Image.Mime = "image/webp"
Config.Image.Quality = 0.95
Next, head to lb-phone/shared/upload.lua and replace the default configuration with the following.
UploadMethods = {
    Custom = {
        Video = {
            url = "https://cdn.sacul.cloud/YOUR_BUCKET_NAME",
            field = "file",
            headers = {
                ["Authorization"] = "YOUR_API_KEY"
            },
            error = {
                path = "success",
                value = false
            },
            success = {
                path = "url"
            },
            suffix = "",
        },
        Image = {
            url = "https://cdn.sacul.cloud/YOUR_BUCKET_NAME",
            field = "file",
            headers = {
                ["Authorization"] = "YOUR_API_KEY"
            },
            error = {
                path = "success",
                value = false
            },
            success = {
                path = "url"
            },
            suffix = "",
        },
        Audio = {
            url = "https://cdn.sacul.cloud/YOUR_BUCKET_NAME",
            field = "file",
            headers = {
                ["Authorization"] = "YOUR_API_KEY"
            },
            error = {
                path = "success",
                value = false
            },
            success = {
                path = "url"
            },
            suffix = "",
        },
    }
}
And that’s it! You have successfully configured LB-Phone to use sCloud CDN.

LB-Tablet Configuration

First, open the main LB-Tablet configuration file in lb-tablet/config/config.lua and scroll down to Config.UploadMethod to set the following values.
Config.UploadMethod.Video = "Custom"
Config.UploadMethod.Image = "Custom"
Config.UploadMethod.Audio = "Custom"
Optionnaly, you can edit the following configuration
Config.Video = {}
Config.Video.Bitrate = 500
Config.Video.FrameRate = 24
Config.Video.MaxSize = 50
Config.Video.MaxDuration = 120

Config.Image = {}
Config.Image.Mime = "image/webp"
Config.Image.Quality = 0.95
Next, head to lb-tablet/config/upload.lua and replace the default configuration with the following.
UploadMethods = {
    Custom = {
        Video = {
            url = "https://cdn.sacul.cloud/YOUR_BUCKET_NAME",
            field = "file",
            headers = {
                ["Authorization"] = "YOUR_API_KEY"
            },
            error = {
                path = "success",
                value = false
            },
            success = {
                path = "url"
            },
            suffix = "",
        },
        Image = {
            url = "https://cdn.sacul.cloud/YOUR_BUCKET_NAME",
            field = "file",
            headers = {
                ["Authorization"] = "YOUR_API_KEY"
            },
            error = {
                path = "success",
                value = false
            },
            success = {
                path = "url"
            },
            suffix = "",
        },
        Audio = {
            url = "https://cdn.sacul.cloud/YOUR_BUCKET_NAME",
            field = "file",
            headers = {
                ["Authorization"] = "YOUR_API_KEY"
            },
            error = {
                path = "success",
                value = false
            },
            success = {
                path = "url"
            },
            suffix = "",
        },
    }
}
And that’s it! You have successfully configured LB-Tablet to use sCloud CDN.