documentation
  • GENERAL INFORMATION
    • 🔷Tebex Integration
    • 👾Code Creator
    • 🔌REACT
  • PACKAGES
    • RADIO
    • NPC DIALOG
    • CARPLAY
    • SCOREBOARD
    • CARSHOP
    • GARAGE
    • GUNSHOP
    • RENT A CAR
    • CRAFTING
    • DRIVING SCHOOL
    • CUSTOMS
    • CASE
    • DAİLYREWARD
    • BLACKMARKET
    • REPORT
    • CLOTHESHOP
    • REGİSTER
    • CREATOR
    • VIPSYSTEM
    • NOTIFICATION
    • FİSHİNG
    • DİVİNG
    • PROGRESS & NOTIFY
    • NEW YEAR
Powered by GitBook
On this page
  1. PACKAGES

GARAGE

FiveM Garage Configuration FiveM Garage Setup FiveM Garage Management FiveM Garage Customization FiveM Garage Locations FiveM Impound Garage FiveM Job Garage FiveM Garage Blips FiveM Garage Script

Garage Script Configuration Guide

1. General Customization

Customize = {
    Framework = "NewESX", -- QBCore - ESX - NewESX - OldQBCore (Write the framework you used as in the example)
    Mysql = "oxmysql", -- oxmysql | ghmattimysql | mysql-async (Write the SQL script you use as in the example)

    AdminNewJobCar = 'newjobvehicle', -- /newjobvehicle PlayerID JobVehicle - (Example: /newjobvehicle 2 police3)
    AdminList = {
        ["license:392d20db55be8ad6069a3c5e135f59e7b0ce1c4d"],
        --["license:"],
    },

    PriceType = 'cash', -- cash - bank
    GaragesPrice = 0,
    ImpoundGaragesPrice = 600,
    JobGaragesPrice = 1,

    Carkeys = function(Plate)
        TriggerEvent('vehiclekeys:client:SetOwner', Plate) --   qb-core
    end,

    VehNotOwnedNotify = function()
        print("Vehicle Not Owner Notification")
    end,
    
    GetVehFuel = function(Veh)
        return GetVehicleFuelLevel(Veh) -- exports["fuel-script"]:GetFuel(Veh) - exports["LegacyFuel"]:GetFuel(Veh) - GetVehicleFuelLevel(Veh)
    end,

    SetVehFuel = function(Veh, Fuel)
        return SetVehicleFuelLevel(Veh, Fuel) -- exports['fuel-script']:SetFuel(Veh, Fuel) - exports['LegacyFuel']:SetFuel(Veh, Fuel) - SetVehicleFuelLevel(Veh, Fuel)
    end,
}

2. Adding Garages

To add garages, you can use the following format. Each garage should be defined with its location, type, and other features.

Example Garage Configuration

Customize.Garages = {
    {
        Blips = {
            Position = vector3(213.56, -809.54, 31.01),
            Label = "Car",
            Sprite = 357,
            Display = 4,
            Scale = 0.5,
            Color = 18,
        },
        Npc = {  Hash = "s_m_y_barman_01", Pos = vector3(213.56, -809.54, 31.01), Heading = 340.67 },
        Type = 'car', -- car, air, sea
        UIName = 'Test Pilbox Hill',
        Camera = {
            vehSpawn = vector4(236.95, -783.71, 30.63, 179.64),
            location = { posX = 233.37, posY = -789.9, posZ = 30.6, rotX = 0.0, rotY = 0.0, rotZ = -22.0, fov = 50.0 },
        },
        VehPutPos = vector3(212.39, -797.34, 30.88),
        VehSpawnPos = vector4(209.64, -791.39, 30.5, 248.63),
    },
    {
        Blips = {
            Position = vector3(463.75, -982.43, 43.69),
            Label = "Air",
            Sprite = 357,
            Display = 4,
            Scale = 0.5,
            Color = 18,
        },
        Npc = {  Hash = "s_m_y_barman_01", Pos = vector3(463.75, -982.43, 43.69), Heading = 89.74 },
        Type = 'air', -- car, air, sea
        UIName = 'Test Pilbox Hill',
        Camera = {
            vehSpawn = vector4(-75.3122, -818.490, 326.17, 201.5),
            location = { posX = -58.0, posY = -828.5, posZ = 335.17, rotX = -25.0, rotY = 0.0, rotZ = 73.2, fov = 40.0 },
        },
        VehPutPos = vector3(449.76, -981.27, 43.69),
        VehSpawnPos = vector4(449.85, -981.23, 43.69, 93.23),
    },
    {
        Blips = {
            Position = vector3(-869.43, -1491.55, 5.17),
            Label = "Sea",
            Sprite = 357,
            Display = 4,
            Scale = 0.5,
            Color = 18,
        },
        Npc = {  Hash = "s_m_y_barman_01", Pos = vector3(-869.43, -1491.55, 5.17), Heading = 112.87 },
        Type = 'sea', -- car, air, sea
        UIName = 'Test Pilbox Hill',
        Camera = {
            vehSpawn = vector4(-855.5, -1484.77, -0.47, 111.13),
            location = { posX = -868.0, posY = -1495.0, posZ = 6.31, rotX = -25.0, rotY = 0.0, rotZ = -40.0, fov = 40.0 },
        },
        VehPutPos = vector3(-858.29, -1475.77, 0.5),
        VehSpawnPos = vector4(-799.54, -1502.98, -0.08, 114.38),
    }
}

4. Adding Impound Garages

Impound garages are also added in a similar way.

Example Impound Garage Configuration

Customize.ImpoundGarages = {
    {
        Blips = {
            Position = vector3(409.43, -1623.11, 29.29),
            Label = "Impound Garages",
            Sprite = 357,
            Display = 4,
            Scale = 0.5,
            Color = 1,
        },
        Npc = {  Hash = "s_m_y_barman_01", Pos = vector3(409.43, -1623.11, 29.29), Heading = 233.95 },
        Type = 'car', -- car, air, sea
        UIName = 'Impound Garage',
        Camera = {
            vehSpawn = vector4(402.04, -1632.39, 28.9, 159.52),
            location = { posX = 402.56, posY = -1644.22, posZ = 31.76, rotX = -10.0, rotY = 0.0, rotZ = 22.0, fov = 50.0 },
        },
        VehSpawnPos = vector4(419.88, -1629.18, 28.9, 140.26),
    },
}

5. Helper Functions

The script includes several helper functions to manage framework integration and SQL execution.

Example Helper Functions

function GetFramework()
    local Get = nil
    if Customize.Framework == "ESX" then
        while Get == nil do
            TriggerEvent('esx:getSharedObject', function(Set) Get = Set end)
            Citizen.Wait(0)
        end
    end
    if Customize.Framework == "NewESX" then
        Get = exports['es_extended']:getSharedObject()
    end
    if Customize.Framework == "QBCore" then
        Get = exports["qb-core"]:GetCoreObject()
    end
    if Customize.Framework == "OldQBCore" then
        while Get == nil do
            TriggerEvent('QBCore:GetObject', function(Set) Get = Set end)
            Citizen.Wait(200)
        end
    end
    return Get
end

function ExecuteSql(query)
    local IsBusy = true
    local result = nil
    if Customize.Mysql == "oxmysql" then
        if MySQL == nil then
            exports.oxmysql:execute(query, function(data)
                result = data
                IsBusy = false
            end)
        else
            MySQL.query(query, {}, function(data)
                result = data
                IsBusy = false
            end)
        end
    elseif Customize.Mysql == "ghmattimysql" then
        exports.ghmattimysql:execute(query, {}, function(data)
            result = data
            IsBusy = false
        end)
    elseif Customize.Mysql == "mysql-async" then   
        MySQL.Async.fetchAll(query, {}, function(data)
            result = data
            IsBusy = false
        end)
    end
    while IsBusy do
        Citizen.Wait(0)
    end
    return result
end

Summary

This guide helps you configure your garage script by providing detailed examples for general customization, adding garages, job garages, impound garages, and helper functions. By following this structure, you can easily manage and expand your FiveM server's garage system.

Feel free to adjust the examples to fit your specific needs and integrate them into your GitBook documentation for better visibility and usability.

PreviousCARSHOPNextGUNSHOP

Last updated 11 months ago