sg-garages

v3.0.0

A comprehensive garage system for QBCore and QBox frameworks with advanced features including impound system, job garages, vehicle sharing, and physical garage preview with drive-out functionality.

QBCore / QBoxPurchase

Overview

sg-garages is a feature-rich garage management system designed for QBCore and QBox servers. It provides everything from basic vehicle storage to advanced features like physical garage previews, job-specific vehicle management, and a comprehensive impound system with authorization levels.

Framework

QBCore / QBox (Auto-detect)

Version

3.0.0

Features

Core Features

  • Multi-Framework Support - Auto-detects and supports both QBCore and QBox
  • Dynamic Garage Management - Create, edit, and delete garages in-game with admin commands
  • Vehicle Storage - Store and retrieve vehicles with full customization preservation
  • Vehicle Sharing - Share vehicles with other players temporarily
  • Transfer System - Transfer vehicles between garages with configurable fees
  • Physical Garage Preview - View your favorite vehicles in a 3D garage space with drive-out functionality

Vehicle Management

  • Favorite Vehicles - Mark vehicles as favorites for quick access
  • Custom Names - Set custom names for your vehicles
  • Vehicle Images - Add custom images for vehicles in the UI
  • Damage Preservation - Vehicle damage is saved and restored on spawn
  • Fuel Integration - Supports LegacyFuel, ox_fuel, and qb-fuel
  • Spawn Method Toggle - Choose between client-side or server-side vehicle spawning
  • Smooth Vehicle Spawning - 1-second fade-in effect when vehicles spawn for a polished experience

Garage Types

Car Garages

Standard vehicle storage

Boat Garages

Marina/boat storage locations

Aircraft Garages

Helicopter and plane storage

Job Garages

Job-specific vehicle spawning

Dependencies

Required

  • oxmysql - Database operations
  • ox_lib - UI and utilities
  • PolyZone - Zone detection
  • qb-core or qbx_core - Framework
  • qb-vehiclekeys or qbx_vehiclekeys - Vehicle keys

Installation

1

Install Dependencies

Ensure all required dependencies listed above are installed and running.

2

Database Setup

Run the appropriate SQL file from the install folder:

  • - install_qbcore.sql for QBCore
  • - install_qbox.sql for QBox

Note: Tables are auto-created on first start if they don't exist.

3

First Time Setup (MANDATORY)

Important: This is required for initial setup, not just migrations.

Config.CopyFromSQL = true  -- Set to true in config.lua
-- This installs all preconfigured garages from the SQL file
-- Start the resource
-- Set back to false after installation completes
4

Configuration

Edit config.lua to customize settings, framework, fuel system, notification provider, etc.

5

Add to server.cfg

ensure oxmysql
ensure ox_lib
ensure PolyZone
ensure qb-core  -- or qbx_core
ensure qb-vehiclekeys  -- or qbx_vehiclekeys
ensure sg-garages

Configuration

Key Config Options

Config.Framework = 'auto'          -- 'auto', 'qbcore', or 'qbox'
Config.StoreForPlayer = true       -- Allow storing vehicles for other players
Config.ApplyDamages = true         -- Apply visual damage when spawning
Config.SharedGarage = false        -- Access vehicles from any garage
Config.UseClientSideSpawning = true -- Client-side spawning (better for mods)
Config.FuelResource = 'LegacyFuel' -- Fuel system integration
Config.NotificationProvider = 'qb' -- 'ox' or 'qb'
Config.TextUIProvider = 'standalone' -- 'ox', 'qb', or 'standalone'
Config.TargetResource = 'qb-target' -- 'qb-target' or 'ox_target'

Garage States

Config.GarageStates = {
    out = 0,           -- Vehicle is spawned
    in_garage = 1,     -- Vehicle is stored
    impounded = 2,     -- Vehicle is impounded
}

Garage Types

Config.GarageTypes = {
    car = 0,           -- Cars, motorcycles, etc.
    boat = 1,          -- Boats
    plane = 2,         -- Planes
    helicopter = 3,    -- Helicopters
}

Admin Commands

CommandDescriptionPermission
/creategarageCreate a new garageAdmin
/managegarageEdit existing garage settingsAdmin
/deletegarageDelete a garageAdmin
/managejobgaragesManage job garagesAdmin
/impoundImpound a vehicleConfigured Jobs

Client Exports

CreateTempGarage

Create a temporary garage (useful for scripts/events)

exports['sg-garages']:CreateTempGarage({
    gid = 'temp_garage_1',
    name = 'Temporary Garage',
    polyzone = {
        points = {
            vector3(x, y, z),
            vector3(x, y, z),
            vector3(x, y, z),
        },
        minZ = z - 1.0,
        maxZ = z + 4.0
    },
    spawns = {
        vector4(x, y, z, heading),
    },
    setting = {
        type = 'car',
        enableblip = false,
        blipname = 'Temp Garage',
        blipnumber = 357,
        blipcolor = 3,
        blipscale = 0.6,
    }
})

RemoveTempGarage

Remove a temporary garage

exports['sg-garages']:RemoveTempGarage('temp_garage_1')

HasTempGarage

Check if a temporary garage exists

local exists = exports['sg-garages']:HasTempGarage('temp_garage_1')

Impound System

Features

  • Authorization Levels - Configure which jobs can impound/release vehicles
  • Self-Release Timer - Set time before owner can self-release
  • Permanent Impounds - Require authorized personnel to release
  • NPC Vehicle Impounding - Impound and remove NPC vehicles from scene
  • Impound Tracking - Track who impounded, when, and why

Configuration

Config.AllowedJobsForImpounding = { 
    ["police"] = 0,  -- Job name and minimum grade
}
Config.ImpoundAlphaJob = "police" -- Job that can release any impound
Config.ReminderNotification = true -- Remind to charge release fee

Usage

  1. Use /impound command while in a vehicle or near one
  2. Fill in reason and release options
  3. Vehicle is impounded and owner is notified
  4. Owner or authorized jobs can release from impound lot

Job Garages

Features

  • Rank Restrictions - Limit vehicles by job rank
  • Vehicle Customization - Pre-configure extras, performance, colors, liveries
  • Outstanding Fines - Charge players for not returning vehicles
  • Prop-Based Access - Use props (parking meters) for interaction
  • Color Options - Choose from preset colors when spawning

Setup

  1. Use /managejobgarages command
  2. Create new job garage with prop location
  3. Add spawn points for vehicles
  4. Add vehicles with rank restrictions and customization
  5. Players with the job can access via prop

Physical Garage Preview

View your favorite vehicles in a 3D space with the ability to drive them out directly from the preview.

How It Works

  1. Open garage UI
  2. Click "Go to Garage" button
  3. Teleports to physical garage with your vehicles displayed
  4. Walk around and view your collection
  5. Uses routing buckets for player isolation

Vehicle Display Logic

  • Favorites First - Favorite vehicles are prioritized and displayed first
  • Spawn Point Limit - Only as many vehicles as configured spawn points will be shown
  • Example: If you have 8 spawn points configured, up to 8 vehicles will display

Drive-Out Feature

  • Enter any preview vehicle by walking up to it
  • TextUI changes to [E] Obtain Keys and Drive Out
  • Press E to receive keys, exit preview, and spawn the vehicle at the actual garage location with a smooth fade-in

Configuration

Config.PhysicallGarageFeatures = true -- Enable physical garage preview
Config.PhysicalGarageSpawnPoint = vector4(x, y, z, heading) -- Player spawn location
Config.PersonalGarageVehicles = { -- Vehicle display spawn points (max vehicles shown = number of points)
    vector4(x, y, z, heading),
    -- Add more spawn points as needed
}
Config.PersonalGarageRoutingBuckets = { -- Routing buckets for player isolation
    {1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
}

Troubleshooting

Vehicles not spawning with mods

Set Config.UseClientSideSpawning = true

Garages not loading

  • - Check database connection
  • - Verify SQL tables were created
  • - Ensure Config.CopyFromSQL = true was set on first run
  • - Check server console for errors

Fuel not saving

  • - Verify Config.FuelResource matches your fuel system
  • - Ensure fuel resource is started before sg-garages

Vehicle keys not working

  • - Ensure vehicle keys resource is started
  • - Check that resource name matches (qb-vehiclekeys or qbx_vehiclekeys)

Framework not detected

  • - Set Config.Framework explicitly instead of 'auto'
  • - Ensure framework is started before sg-garages

Preview vehicles not showing all favorites

  • - The number of vehicles shown is limited by Config.PersonalGarageVehicles spawn points
  • - Add more spawn points to display more vehicles