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.

Prerequisites

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.

Configuration

LB-Phone Configuration

To use presigned uploads with LB-Phone, follow these steps:
  1. Server API Keys & Buckets: Open lb-phone/server/apiKeys.lua and configure your API keys and bucket names.
  2. Server Functions: Update lb-phone/server/custom/functions/functions.lua to implement the GetPresignedUrl function.
  3. Shared Upload Config: In lb-phone/shared/upload.lua, set the url to "PRESIGNED_URL" for your custom methods.
  4. Client Functions: Finally, ensure CustomGetUploadMethod is implemented in lb-phone/client/custom/functions/functions.lua.

LB-Tablet Configuration

Configuration for LB-Tablet is similar to LB-Phone:
  1. Server API Keys & Buckets: Open lb-tablet/server/apiKeys.lua.
  2. Server Functions: Update lb-tablet/server/custom/functions/functions.lua to implement GetPresignedUrl. (The logic is identical to the one in LB-Phone).
  3. Config Upload: In lb-tablet/config/upload.lua, set url = "PRESIGNED_URL".
  4. Client Functions: Implement CustomGetUploadMethod in lb-tablet/client/custom/functions/functions.lua.

Legacy Configuration

This documentation is deceprated, using the following upload method can and will expose your bucket API Key.

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.
Optionnaly, you can edit the following configuration
Next, head to lb-phone/shared/upload.lua and replace the default configuration with the following.
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.
Optionnaly, you can edit the following configuration
Next, head to lb-tablet/config/upload.lua and replace the default configuration with the following.
And that’s it! You have successfully configured LB-Tablet to use sCloud CDN.