Kartik Scripts

Installation

This guide will walk you through installing and configuring Garages V2 on your FiveM server.

๐Ÿ“‹ Prerequisites

Ensure you have the following resources installed and up to date before installing kartik-garages:

  • ox_lib (Required for UI callbacks, zones, and utilities)
  • oxmysql (Required for database transactions)
  • Framework: QB-Core (qb-core), Qbox (qbx_core), or ESX Legacy (es_extended)
  • Target System: ox_target or qb-target (Optional, auto-detected)
  • Vehicle Keys Provider: qb-vehiclekeys, qbx_vehiclekeys, p_vehiclekeys, wasabi_carlock, cd_garage, or custom

๐Ÿ“ฅ Installation Steps

1. Download & Extract

Place the kartik-garages folder into your server's resources/[kartik]/ directory.

2. Database Setup

kartik-garages includes an automated schema setup script (server/schema.lua) that automatically verifies and creates required tables and columns on resource start.

If you prefer manual database execution, run the following SQL queries in your database manager ( HeidiSQL / phpMyAdmin ):

-- Sub-owners table
CREATE TABLE IF NOT EXISTS `garages_vehicle_subowners` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `vehicle_id` VARCHAR(50) NOT NULL,
  `citizen_id` VARCHAR(50) NOT NULL,
  `granted_by` VARCHAR(50) NOT NULL,
  `granted_at` BIGINT NOT NULL,
  INDEX (`vehicle_id`),
  INDEX (`citizen_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Access Groups tables
CREATE TABLE IF NOT EXISTS `garages_access_groups` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `owner_citizen_id` VARCHAR(50) NOT NULL,
  `name` VARCHAR(50) NOT NULL,
  `created_at` BIGINT NOT NULL,
  INDEX (`owner_citizen_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS `garages_access_group_items` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `group_id` INT NOT NULL,
  `type` ENUM('job', 'citizen') NOT NULL,
  `value` VARCHAR(50) NOT NULL,
  `grade` INT DEFAULT 0,
  FOREIGN KEY (`group_id`) REFERENCES `garages_access_groups`(`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Parked Vehicles table
CREATE TABLE IF NOT EXISTS `garages_parked_vehicles` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `vehicle_id` VARCHAR(50) NOT NULL,
  `plate` VARCHAR(20) NOT NULL,
  `citizen_id` VARCHAR(50) NOT NULL,
  `model` VARCHAR(50) NOT NULL,
  `coords` LONGTEXT NOT NULL,
  `heading` FLOAT NOT NULL,
  `props` LONGTEXT NOT NULL,
  `parked_at` BIGINT NOT NULL,
  `location_id` VARCHAR(50) DEFAULT NULL,
  INDEX (`plate`),
  INDEX (`citizen_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

-- Custom Garages table
CREATE TABLE IF NOT EXISTS `garages_locations` (
  `id` VARCHAR(50) PRIMARY KEY,
  `label` VARCHAR(100) NOT NULL,
  `type` VARCHAR(20) NOT NULL DEFAULT 'public',
  `coords` LONGTEXT NOT NULL,
  `spawn_coords` LONGTEXT NOT NULL,
  `created_by` VARCHAR(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

3. Server Configuration (server.cfg)

Add ensure kartik-garages to your server.cfg after your framework, ox_lib, your vehicle keys script and your fuel script:

ensure ox_lib
ensure oxmysql
ensure qb-core # or qbx_core / es_extended
ensure qbx_vehiclekeys # your vehicle keys script
ensure ox_fuel # your fuel script
ensure kartik-garages

Using p_vehiclekeys? Add its key events first, see Physical Keys (p_vehiclekeys).

The keys and fuel scripts are detected when kartik-garages starts. If no supported keys script is running at that moment, garages still work but no keys are given or removed, and the F8 console shows [kartik-garages] No supported vehicle keys script is started. Without a supported fuel script, the fuel level is set with the game's own fuel value.


๐ŸŒ‰ Auto-Detected Framework Bridges

kartik-garages includes an intelligent modular bridge system (bridge/) that automatically detects installed dependencies:

  • Framework Bridge: QB-Core, Qbox, ESX
  • Target Bridge: Auto-detects ox_target or qb-target
  • TextUI Bridge: NUI Prompt, ox_lib, jg-textui, okokTextUI
  • Notification Bridge: NUI Toast, ox_lib, custom
  • Radial Menu Bridge: qb-radialmenu, ox_lib radial menu
  • Fuel Bridge: ox_fuel, LegacyFuel, ps-fuel, cdn-fuel, lj-fuel, lc_fuel, nd_fuel, okokGasStation, qs-fuelstations, rcore_fuel, Renewed-Fuel, hyon_gas_station (game fuel value if none is running)
  • Vehicle Keys Bridge: qb-vehiclekeys, qbx_vehiclekeys, p_vehiclekeys (setup), wasabi_carlock, qs-vehiclekeys, MrNewbVehicleKeys, Renewed-Vehiclekeys, jaksam-vehicles-keys, t1ger_keys, okokGarage (no keys if none is running)
  • Mileage Bridge: Built-in internal DB tracking or external mileage resource
  • Properties Bridge: kartik-properties garages show their real names in the garage list and can be raided by police

On this page