RX Scripts Logo
Garages

Configurables

All config & open sourced files included within this script.

Config Files

--[[
BY RX Scripts © rxscripts.xyz
--]]

Config = {}

Config.Locale = 'en'
Config.RestrictVehiclesToLocations = true -- Restrict taking out vehicles to their saved locations (if false, the vehicles can be taken out no matter of the location)
Config.LocationMarkers = false -- Shows markers at locations (recommended to disable when using LocationNPCS/Target)
Config.LocationNPCS = true    -- Shows NPCs at locations (cannot be disabled if using target, will be applied to npc)
Config.ShowOverview = true -- Show overview page at garages
Config.NameCharactersLimit = 15 -- Limit the amount of characters in the vehicle name
Config.PlayerVehiclesToSharedGarages = false -- If enabled, players can park their own vehicles in shared garages and park back in own garage (if they have access)
Config.ShowParkMarkerDistance = 10 -- Distance to show the park marker
Config.ParkVehicleDistance = 2.5 -- Distance to park the vehicle
Config.ServerSpawnedVehicles = false -- If enabled, vehicles will be spawned server-sided. This will make vehicles persistent (unless vehicle wipe is enabled ofcourse).

Config.TransferVehicles = {
    toGarages = { -- Automatically disables when Config.RestrictVehiclesToLocations is set to false
        enabled = true,
        cost = 5000, -- Set to 0 to disable the transfer price
        moneyType = 'bank',
    },
    toPlayers = {
        enabled = true,
        showSteamName = true, -- Set to false if you want to hide the steam name, and only show the Player ID
        cost = 5000, -- Set to 0 to disable the transfer price
        moneyType = 'bank',
    }
}

Config.Settings = {
    garage = {
        car = {
            npcModel = 'csb_vagspeak',
            blip = {
                enabled = true,
                label = 'Garage',
                sprite = 524,
                color = 3,
                display = 2,
                scale = 0.7,
                shortrange = true,
            },
        },
        boat = {
            npcModel = 'cs_taostranslator',
            blip = {
                enabled = true,
                label = 'Garage',
                sprite = 410,
                color = 3,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
        air = {
            npcModel = 'csb_agatha',
            blip = {
                enabled = true,
                label = 'Garage',
                sprite = 43,
                color = 3,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
    },
    shared = {
        car = {
            npcModel = 'csb_vagspeak',
            blip = {
                enabled = true,
                label = 'Shared Garage',
                sprite = 524,
                color = 2,
                display = 2,
                scale = 0.7,
                shortrange = true,
            },
        },
        boat = {
            npcModel = 'cs_taostranslator',
            blip = {
                enabled = true,
                label = 'Shared Garage',
                sprite = 410,
                color = 2,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
        air = {
            npcModel = 'csb_agatha',
            blip = {
                enabled = true,
                label = 'Shared Garage',
                sprite = 43,
                color = 2,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
    },
    impound = {
        car = {
            npcModel = 'a_m_m_hillbilly_01',
            blip = {
                enabled = true,
                label = 'Impound',
                sprite = 524,
                color = 5,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
        boat = {
            npcModel = 'a_m_m_hillbilly_01',
            blip = {
                enabled = true,
                label = 'Impound',
                sprite = 410,
                color = 5,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
        air = {
            npcModel = 'a_m_m_hillbilly_01',
            blip = {
                enabled = true,
                label = 'Impound',
                sprite = 43,
                color = 5,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
    },
    spawner = {
        car = {
            npcModel = 'csb_vagspeak',
            blip = {
                enabled = true,
                label = 'Job Garage',
                sprite = 524,
                color = 3,
                display = 2,
                scale = 0.7,
                shortrange = true,
            },
        },
        boat = {
            npcModel = 'cs_taostranslator',
            blip = {
                enabled = true,
                label = 'Job Garage',
                sprite = 410,
                color = 3,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
        air = {
            npcModel = 'csb_agatha',
            blip = {
                enabled = true,
                label = 'Job Garage',
                sprite = 43,
                color = 3,
                display = 2,
                scale = 0.7,
                shortrange = true,
            }
        },
    }
}

Config.Impound = {
    releaseMoneyType = 'bank', -- Account from framework, to check/take money from on releasing a vehicle from the impound
    allowedJobs = {
        { job = 'police', minGrade = 0 },
    }
}

Config.VehicleWipe = {
    enabled = true,
    sendTo = 'garage', -- 'garage' or 'impound'
    wipeInterval = 30, -- Wipe interval in minutes
    inactiveTime = 5, -- Minutes a vehicle has to be inactive to be wiped
    notify = true, -- Send a notification before the wipe - inactivetime as reminder, and when the wipe has been done
}

Config.VehicleDespawn = { -- Settings for when vehicles are despawned, to send them back to the garage or impound
    checkWait = 3000, -- In milliseconds
    sendTo = 'impound', -- 'garage' or 'impound'
}

Config.Commands = {
    openAdminPanel = 'garages:admin', -- /garages:admin | Open the admin garages panel
    openImpoundMenu = 'impound', -- /impound | Open the impound menu
    wipeVehicles = 'wipevehicles', -- /wipevehicles | Wipe all inactive vehicles for inactiveTime in Config.VehicleWipe
}

--[[
    YOU CAN USE ACE PERMISSIONS TO ALLOW CERTAIN PLAYERS/GROUPS TO ACCESS THE ADMIN GARAGES PANEL
    EXAMPLE:
        add_ace group.admin garages allow
        add_ace identifier.fivem:1432744 garages allow #Rejox

    OR YOU CAN USE THE STAFF GROUPS BELOW
--]]
Config.StaffGroups = {
    'superadmin',
    'admin',
    'god',
}

Config.UI = {
    toggleTheme = false, -- Enable toggling to light mode
    color = {
        primary = { -- Different shades of primary color
            [50] = "#FEDDE9",
            [100] = "#FCBAD3",
            [200] = "#FA76A6",
            [300] = "#F7317A",
            [400] = "#D80955",
            [500] = "#95063B",
            [600] = "#76052E",
            [700] = "#580423",
            [800] = "#3B0217",
            [900] = "#1D010C",
            [950] = "#0F0106"
        },
    }
}

--[[
    ONLY CHANGE THIS PART IF YOU HAVE RENAMED SCRIPTS SUCH AS FRAMEWORK, TARGET, INVENTORY ETC
    RENAME THE SCRIPT NAME TO THE NEW NAME
--]]
---@type table Only change these if you have changed the name of a resource
Resources = {
    FM = { name = 'fmLib', export = 'new' },
    OXTarget = { name = 'ox_target', export = 'all' },
    QBTarget = { name = 'qb-target', export = 'all' },
}
IgnoreScriptFoundLogs = false

Opensource Files

All script-related open source code is contained within these files. Third-party components, including frameworks, inventory systems, and other external code, are separately maintained & open sourced in our fmLib repository.
--[[
BY RX Scripts © rxscripts.xyz
--]]

---@param type 'open_car_garage' | 'open_boat_garage' | 'open_air_garage' | 'park_vehicle'
function ShowMarker(type, coords)
    if type == 'open_car_garage' then
        DrawMarker(36, coords, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 128, 2, 49, 100, false, false, 2, true, false, false,
            false)
    elseif type == 'open_boat_garage' then
        DrawMarker(35, coords, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 128, 2, 49, 100, false, false, 2, true, false, false,
            false)
    elseif type == 'open_air_garage' then
        DrawMarker(33, coords, 0, 0, 0, 0, 0, 0, 1.0, 1.0, 1.0, 128, 2, 49, 100, false, false, 2, true, false, false,
            false)
    elseif type == 'park_vehicle' then
        DrawMarker(1, coords, 0, 0, 0, 0, 0, 0, 3.0, 3.0, 0.5, 128, 2, 49, 100, false, false, 2, false, false, false, false)
    end
end

function AddOpenGarageTarget(garageId)
    local garage = Garages[garageId]

    if OXTarget then
        OXTarget:addLocalEntity(garage.ped, {
            {
                label = 'Open ' .. garage.name,
                name = 'openGarageNPC',
                icon = 'fas fa-trowel',
                distance = 2.5,
                onSelect = function(data)
                    OpenGarage(garage.name, garage.garageType, garage.vehicleType)
                end,
            }
        })
    elseif QBTarget then
        QBTarget:AddTargetEntity(garage.ped, {
            options = {
                {
                    label = 'Open ' .. garage.name,
                    icon = 'fas fa-trowel',
                    targeticon = 'fas fa-trowel',
                    action = function(entity)
                        OpenGarage(garage.name, garage.garageType, garage.vehicleType)
                    end,
                }
            },
            distance = 2.5,
        })
    end
end