wrenchInstallation

1. Download Resource

Download the purchased resource from CFX Portalarrow-up-right - the official site of FiveM with purchased resources.

2. Install Required Dependencies

This script needs a few extra resources to work properly. Below you will find a list of things to download - click the link, download and upload to your server just like other resources.

3. Import Database Tables

This is a very important step - without it, the script will not work properly. Depending on the framework you are using (ESX, QBCORE or QBOX), select the appropriate section below and paste the SQL code into your database.

chevron-rightSQL for Databasehashtag
-- Accounts table - stores user profiles
CREATE TABLE IF NOT EXISTS `lb_companion_accounts` (
  `identifier` VARCHAR(50) NOT NULL,
  `username` VARCHAR(50) NOT NULL UNIQUE,
  `display_name` VARCHAR(100) NOT NULL,
  `password` VARCHAR(255) NOT NULL,
  `password_salt` VARCHAR(255) DEFAULT NULL,
  `bio` TEXT DEFAULT NULL,
  `avatar` TEXT DEFAULT NULL,
  `category` VARCHAR(50) DEFAULT NULL,
  `gender` VARCHAR(20) DEFAULT NULL,
  `service_types` TEXT DEFAULT NULL,
  `pricing` TEXT DEFAULT NULL,
  `photos` TEXT DEFAULT NULL,
  `verification` VARCHAR(20) DEFAULT 'none',
  `is_provider` TINYINT(1) DEFAULT 0,
  `is_online` TINYINT(1) DEFAULT 0,
  `rating` DECIMAL(3,2) DEFAULT 0.00,
  `review_count` INT(11) DEFAULT 0,
  `followers` INT(11) DEFAULT 0,
  `following` INT(11) DEFAULT 0,
  `created_at` BIGINT(20) NOT NULL,
  PRIMARY KEY (`identifier`),
  KEY `idx_username` (`username`),
  KEY `idx_category` (`category`),
  KEY `idx_is_provider` (`is_provider`),
  KEY `idx_is_online` (`is_online`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Posts table - stores service listings
CREATE TABLE IF NOT EXISTS `lb_companion_posts` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `post_id` VARCHAR(50) NOT NULL UNIQUE,
  `author_id` VARCHAR(50) NOT NULL,
  `title` VARCHAR(200) NOT NULL,
  `description` TEXT DEFAULT NULL,
  `category` VARCHAR(50) DEFAULT NULL,
  `service_types` TEXT DEFAULT NULL,
  `pricing` TEXT DEFAULT NULL,
  `photos` TEXT DEFAULT NULL,
  `location` VARCHAR(200) DEFAULT 'Available City-Wide',
  `available` TINYINT(1) DEFAULT 1,
  `likes` INT(11) DEFAULT 0,
  `views` INT(11) DEFAULT 0,
  `created_at` BIGINT(20) NOT NULL DEFAULT UNIX_TIMESTAMP(),
  PRIMARY KEY (`id`),
  KEY `idx_post_id` (`post_id`),
  KEY `idx_author_id` (`author_id`),
  KEY `idx_category` (`category`),
  KEY `idx_created_at` (`created_at`),
  FOREIGN KEY (`author_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Reviews table - stores provider reviews
CREATE TABLE IF NOT EXISTS `lb_companion_reviews` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `review_id` VARCHAR(50) NOT NULL UNIQUE,
  `provider_id` VARCHAR(50) NOT NULL,
  `customer_id` VARCHAR(50) NOT NULL,
  `rating` INT(1) NOT NULL CHECK (`rating` >= 1 AND `rating` <= 5),
  `comment` TEXT DEFAULT NULL,
  `created_at` BIGINT(20) NOT NULL DEFAULT UNIX_TIMESTAMP(),
  PRIMARY KEY (`id`),
  KEY `idx_review_id` (`review_id`),
  KEY `idx_provider_id` (`provider_id`),
  KEY `idx_customer_id` (`customer_id`),
  FOREIGN KEY (`provider_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE,
  FOREIGN KEY (`customer_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Follows table - stores follow relationships
CREATE TABLE IF NOT EXISTS `lb_companion_follows` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `follower_id` VARCHAR(50) NOT NULL,
  `target_id` VARCHAR(50) NOT NULL,
  `created_at` BIGINT(20) NOT NULL DEFAULT UNIX_TIMESTAMP(),
  PRIMARY KEY (`id`),
  UNIQUE KEY `unique_follow` (`follower_id`, `target_id`),
  KEY `idx_follower_id` (`follower_id`),
  KEY `idx_target_id` (`target_id`),
  FOREIGN KEY (`follower_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE,
  FOREIGN KEY (`target_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Bookings table - stores service bookings
CREATE TABLE IF NOT EXISTS `lb_companion_bookings` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `booking_id` VARCHAR(50) NOT NULL UNIQUE,
  `customer_id` VARCHAR(50) NOT NULL,
  `provider_id` VARCHAR(50) NOT NULL,
  `service_type` VARCHAR(100) DEFAULT NULL,
  `duration` INT(11) DEFAULT 0,
  `price` DECIMAL(10,2) DEFAULT 0.00,
  `location` VARCHAR(200) DEFAULT NULL,
  `status` VARCHAR(20) DEFAULT 'pending',
  `created_at` BIGINT(20) NOT NULL DEFAULT UNIX_TIMESTAMP(),
  PRIMARY KEY (`id`),
  KEY `idx_booking_id` (`booking_id`),
  KEY `idx_customer_id` (`customer_id`),
  KEY `idx_provider_id` (`provider_id`),
  KEY `idx_status` (`status`),
  FOREIGN KEY (`customer_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE,
  FOREIGN KEY (`provider_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Messages table - stores direct messages
CREATE TABLE IF NOT EXISTS `lb_companion_messages` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `conversation_id` VARCHAR(100) NOT NULL,
  `sender_id` VARCHAR(50) NOT NULL,
  `receiver_id` VARCHAR(50) NOT NULL,
  `message` TEXT NOT NULL,
  `is_read` TINYINT(1) DEFAULT 0,
  `created_at` BIGINT(20) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_conversation_id` (`conversation_id`),
  KEY `idx_sender_id` (`sender_id`),
  KEY `idx_receiver_id` (`receiver_id`),
  KEY `idx_created_at` (`created_at`),
  FOREIGN KEY (`sender_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE,
  FOREIGN KEY (`receiver_id`) REFERENCES `lb_companion_accounts`(`identifier`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

4. Add Required App

Add the Required App to your LB-Phone configuration so it matches your framework setup, copy the installation files from orbit-companionapp/install into the lb-phone/config/config.lua file.

chevron-rightESX Installationhashtag
-- ============================================
-- ESX COMPANION APP INSTALLATION
-- ============================================
-- This file contains everything needed for ESX
-- 
-- STEP 1: Run the SQL in your database
-- ============================================

-- [[[ STEP 1: SQL DATABASE SETUP ]]]
-- Run database.sql in your database (phpMyAdmin, HeidiSQL, etc.)

-- [[[ STEP 2: LB-PHONE SETUP ]]]
-- Add this to lb-phone/config/config.lua in Config.CustomApps:

{
    name = "Companion App",
    identifier = "companionapp",
    description = "Premium companion service - Available 24/7",
    developer = "Orbit Scripts",
    defaultApp = false,
    size = 59812,
    images = {},
    ui = "orbit-companionapp/ui/index.html",
    icon = "https://r2.fivemanage.com/EkrLtzIQN5yDnOwdIDUVT/bd702201a2b6d8960734f60f34a22754.jpg"
}

print("========================================")
print("ESX Companion App Installation Complete")
print("========================================")
print("1. Run database.sql in your database")
print("2. Add app config to lb-phone")
print("3. Set Framework = 'ESX' in config.lua")
print("4. Restart your server")
print("========================================")
chevron-rightQBCORE Installationhashtag
chevron-rightQBOX Installationhashtag

5. Configuration

Configure config.lua to match your server framework and preferences, and change the configuration options to your own liking.

scrollConfiguration Fileschevron-right

6. Start Resource

To start a resource in your server.cfg, ensure that it begins after your framework has been initiated. For instance, if you are using a framework like es_extended, you should start resource after it, like so:

Last updated