diff --git a/pages/garage/_meta.ts b/pages/garage/_meta.ts index 08042a2..dc3fd7a 100644 --- a/pages/garage/_meta.ts +++ b/pages/garage/_meta.ts @@ -1,6 +1,7 @@ export default { description: "Description", - installationguide: "Installation guide", - faq: "Frequently asked questions", - devdocs: "Developer documentation" + installationguide: "Installation Guide", + configurationguide: "Configuration Guide", + faq: "Frequently Asked Questions", + devdocs: "Developer Documentation" }; diff --git a/pages/garage/configurationguide.mdx b/pages/garage/configurationguide.mdx new file mode 100644 index 0000000..fea3f4d --- /dev/null +++ b/pages/garage/configurationguide.mdx @@ -0,0 +1,768 @@ +import { Callout } from "nextra/components"; + +# Configuration Guide + +Zerio Garage v3 uses a modular configuration system with multiple files organized by functionality. This guide explains all available configuration options. + +## Configuration Files Overview + +All configuration files are located in the `configs/` folder: + +| File | Purpose | +| ------------------ | ---------------------------------------------------- | +| `core.lua` | Core settings (locale, debug) | +| `garage.lua` | Garage behavior and payment settings | +| `vehicle.lua` | Vehicle spawning and condition management | +| `features.lua` | Advanced features (sales, transfers, admin commands) | +| `interactions.lua` | Interaction system configuration | +| `logging.lua` | Webhook and nearby player detection | + +--- + +## Core Configuration (`configs/core.lua`) + +### Language Settings + +```lua +Config.Locale = "en" +``` + +Sets the language for all in-game text. Must match a file in the `locales/` folder (e.g., `en.lua`, `de.lua`, `es.lua`). + +**Available locales**: Check the `locales/` folder for available translations. + +--- + +```lua +Config.BrowserLocale = "en-US" +``` + +Sets the browser locale for date/time/currency formatting in the UI. + +**Format**: BCP 47 language tags (e.g., `"en-US"`, `"en-GB"`, `"de-DE"`, `"fr-FR"`, `"es-ES"`, `"pt-BR"`) + +--- + +### Debug Settings + +```lua +Config.Debug = true +Config.DebugPolyZone = false +``` + +- `Config.Debug`: Enables detailed debug prints in console (useful for troubleshooting) +- `Config.DebugPolyZone`: Enables PolyZone debug visualization (shows zone boundaries) + + + Disable debug mode (`Config.Debug = false`) in production for better + performance. + + +--- + +## Garage Configuration (`configs/garage.lua`) + +### Vehicle Display Behavior + +```lua +Config.ShowVehiclesFromAllGarages = true +``` + +Controls which vehicles appear in garage menus: + +- **`true`**: Show all your vehicles in every garage menu (regardless of storage location) +- **`false`**: Only show vehicles stored at the specific garage you're accessing + + + This only affects personal garages, not job/gang garages. + + +--- + +```lua +Config.AllowTakeoutFromAnyGarage = false +``` + +Controls whether you can retrieve vehicles from garages other than where they're stored: + +- **`true`**: Take out any vehicle from any garage (instant access) +- **`false`**: Can only take out vehicles from their storage location (button disabled otherwise) + + + Even when set to `false`, players can still use the transfer system to move + vehicles between garages. + + +--- + +### Spawn Point Selection + +```lua +Config.SpawnPointStrategy = "closest_available" +``` + +Controls how spawn points are selected when multiple are available: + +| Strategy | Behavior | +| --------------------- | ------------------------------------------------- | +| `"closest_available"` | Selects the nearest available spawn to the player | +| `"first_available"` | Uses the first available spawn in table order | +| `"random_available"` | Randomly selects from available spawns | + +Applies to all garage types (personal, job, gang, impound, housing). + +--- + +### Payment Settings + +```lua +Config.PayImpoundFrom = "bank" +``` + +Determines which account is charged for impound fees: + +- `"bank"`: Bank account +- `"money"`: Cash + +--- + +```lua +Config.Currency = "USD" +``` + +Sets the currency code for display formatting in the UI. Must be a valid ISO 4217 currency code. + +**Examples**: `"USD"`, `"EUR"`, `"GBP"`, `"CAD"`, `"AUD"`, `"JPY"` + +--- + +### Multiple Takeouts (Bossmenu Integration) + +```lua +Config.AllowMultipleTakeOuts = false +``` + +Only applies when using zerio-bossmenu integration: + +- **`true`**: Allow multiple copies of the same job vehicle simultaneously +- **`false`**: Only one copy of each vehicle can be out at a time + +--- + +## Vehicle Configuration (`configs/vehicle.lua`) + +### Vehicle Existence Checks + +```lua +Config.CheckIfVehicleAlreadyExists = true +``` + +- **`true`**: Prevents spawning if vehicle already exists in the world +- **`false`**: Always allows spawning (can create duplicates) + + + Recommended to keep `true` for realism and preventing exploits. + + +--- + +```lua +Config.CheckForVehicleInTheWay = true +``` + +- **`true`**: Only spawns if spawn point is clear +- **`false`**: Always spawns (can spawn inside other vehicles) + +--- + +### Vehicle Condition Management + +```lua +Config.SaveVehicleDamages = true +Config.SaveFuelLevel = true +``` + +Controls what vehicle data is saved when storing: + +- `SaveVehicleDamages`: Saves engine and body damage +- `SaveFuelLevel`: Saves current fuel level + +When enabled, vehicles are restored with their saved condition. + +--- + +```lua +Config.FixVehicleOnGarage = false +Config.FixVehicleOnImpound = true +``` + +Auto-repair settings: + +- `FixVehicleOnGarage`: Repairs vehicle when storing in personal garage +- `FixVehicleOnImpound`: Repairs vehicle when retrieving from impound + +--- + +### Damage Multipliers + +```lua +Config.Multipliers = { + Fuel = 1, + Engine = 0.1, + Chassi = 0.1 +} +``` + +Multipliers for displaying health percentages in the UI: + +- `Fuel`: Fuel level multiplier (1 = 100% scale) +- `Engine`: Engine health multiplier +- `Chassi`: Body/chassis health multiplier + + + The engine and chassis values are typically 1000 in FiveM, so a 0.1 multiplier + converts them to percentage (0-100). + + +--- + +### Vehicle Name Fetching + +```lua +Config.NameFetching = "default" +``` + +Controls how vehicle names are fetched: + +| Option | Description | Framework | +| ----------- | --------------------------- | --------- | +| `"default"` | FiveM native functions | Both | +| `"zerio"` | zerio-cardealers database | Both | +| `"esx"` | ESX cardealer table | ESX only | +| `"qb"` | QB-Core shared vehicles | QB only | +| `"custom"` | Custom function (see below) | Both | + +**Custom Name Fetching**: + +```lua +Config.NameFetching = "custom" +Config.CustomNameFetch = function(modelName) + -- Your custom logic here + local name = exports['my-cardealer']:GetVehicleName(modelName) + return name or modelName -- Fallback to model name +end +``` + +If the selected method fails, it automatically falls back to `"default"`. + +--- + +### Server Restart Behavior + +```lua +Config.ResetVehiclesAfterRestart = false +``` + +- **`true`**: All vehicles are marked as "stored" when server restarts +- **`false`**: Vehicles maintain their state (out or stored) + + + Useful if you want to prevent "ghost vehicles" after unexpected server + crashes. + + +--- + +## Features Configuration (`configs/features.lua`) + +### Vehicle Sales System + +```lua +Config.VehicleSales = { + Enabled = true, + MaxPrice = 1000000, -- Maximum sale price (0 = no limit) + RequestCooldown = 60, -- Cooldown between requests (seconds) + PaymentMethods = { "bank", "cash" }, + DefaultPaymentMethod = "bank" +} +``` + +Controls the player-to-player vehicle sale system: + +- `Enabled`: Enable/disable the entire sales feature +- `MaxPrice`: Prevents unrealistic sale prices (0 = unlimited) +- `RequestCooldown`: Prevents spam (0 = no cooldown) +- `PaymentMethods`: Available payment options for buyers +- `DefaultPaymentMethod`: Pre-selected payment method + +--- + +### Vehicle Transfer System + +```lua +Config.VehicleTransfer = { + Enabled = true, + TransferCost = 500, -- Cost per transfer (0 = free) + PaymentMethod = "bank", -- "bank" or "cash" + TransferTime = 10, -- Transfer duration in seconds (0 = instant) + AllowImpoundTransfer = true, -- Allow transferring FROM impound +} +``` + +Controls vehicle transfers between garages: + +- `TransferCost`: Fee charged for each transfer +- `PaymentMethod`: Which account is charged +- `TransferTime`: How long vehicles are unavailable during transfer (creates realism) +- `AllowImpoundTransfer`: Whether vehicles can be transferred from impound to garages + + + Transferring **TO** impound is never allowed. `AllowImpoundTransfer` only + controls transferring **FROM** impound. When transferring from impound, + players pay: `TransferCost + ImpoundFee` + + +--- + +### Job Vehicle System + +```lua +Config.JobVehicles = { + NotifyOnTakeout = false, + DefaultTrackOutState = false, + DefaultSaveCondition = false, + DefaultSharedLocations = false, + DefaultAllowCustomization = false, + + PresetSystem = { + Enabled = true, + MaxPersonalPresets = 0, -- 0 = unlimited + AllowPresetSharing = true, + ShareCodePrefix = "ZGP_", + } +} +``` + +**Job Vehicle Defaults**: These apply to newly created job garages (can be overridden per garage): + +- `DefaultTrackOutState`: Track when vehicles are taken out and by whom +- `DefaultSaveCondition`: Save vehicle damage and fuel when stored +- `DefaultSharedLocations`: Allow vehicles to be accessed from any location +- `DefaultAllowCustomization`: Enable preset system for that garage + +**Preset System**: + +- `Enabled`: Enable/disable the preset system entirely +- `MaxPersonalPresets`: Limit presets per player (0 = unlimited) +- `AllowPresetSharing`: Players can share presets via codes +- `ShareCodePrefix`: Prefix for shared preset codes + +--- + +### Police Impound System + +```lua +Config.PoliceImpound = { + Enabled = true, + Command = "impound", + + AllowedJobs = { "police", "sheriff" }, + + PriceMode = "range", -- "fixed" or "range" + FixedPrice = 500, + MinPrice = 100, + MaxPrice = 5000, + + MaxDistance = 10.0, -- Max distance to vehicle + OfficerSelectsImpound = false, -- Let officer choose impound lot + NotifyOwner = true, -- Notify vehicle owner + + Reasons = { + "police_impound_reason_illegally_parked", + "police_impound_reason_abandoned_vehicle", + "police_impound_reason_evidence_seizure", + "police_impound_reason_unpaid_fines", + }, +} +``` + +**Price Modes**: + +- `"fixed"`: Always uses `FixedPrice` +- `"range"`: Officer enters fee between `MinPrice` and `MaxPrice` + +**Reasons**: Predefined quick-select reasons (these are locale keys, translated via the locale system) + +--- + +### Admin Car Command + +```lua +Config.AdminCarCommand = { + Enabled = FrameworkName ~= "QB", -- Disabled on QB-Core by default + Command = "admincar", +} +``` + +Command for admins to instantly spawn vehicles. + + + Disabled by default on QB-Core since `qb-core` provides its own `/car` + command. + + +--- + +### Plate Changer Command + +```lua +Config.PlateChanger = { + Enabled = true, + Command = "changeplate", +} +``` + +Admin command to change vehicle plates with database synchronization. + +--- + +### Vehicle Preview Camera + +```lua +Config.VehiclePreview = { + Enabled = true, + DefaultDistance = 6.0, -- Base camera distance from vehicle + OrbitSensitivity = 2.0, -- Mouse orbit speed (higher = faster) +} +``` + +Controls the 3D vehicle preview camera system: + +- When enabled, opening a garage transitions the camera to the spawn area +- Players can preview vehicles before taking them out +- Right-click and drag to orbit the camera around the vehicle +- Camera distance auto-scales for larger vehicles + +--- + +## Interactions Configuration (`configs/interactions.lua`) + +### Interaction Type + +```lua +Config.Interaction = { + Type = "normal", -- "normal", "proximity", "target", "custom" +} +``` + +Sets the main interaction system: + +| Type | Description | Requirements | +| ------------- | --------------------- | -------------------------------- | +| `"normal"` | Traditional help text | None | +| `"proximity"` | Proximity prompts | zerio-proximityprompt | +| `"target"` | Target system | ox_target, qb-target, or qtarget | +| `"custom"` | Custom integration | Your custom system | + +--- + +### Normal Help Text Configuration + +```lua +Config.Interaction.HelpText = { + Enabled = true, + Style = "Floating", -- See styles below + Position = "left", -- For QBCore/okokTextUI + TextType = "info", -- For ESXTextUI +} +``` + +**Available Styles**: + +| Style | Description | Dependency | +| ---------------- | ----------------------------------- | ------------- | +| `"Default"` | Traditional bottom-left help text | None | +| `"Floating"` | 3D floating text at marker position | None | +| `"QBCore"` | QB-Core DrawText system | qb-core | +| `"okokTextUI"` | okokTextUI system | okokTextUI | +| `"JGTextUI"` | jg-textui system | jg-textui | +| `"ESXTextUI"` | esx_textui system | esx_textui | +| `"CDDrawTextUI"` | cd_drawtextui system | cd_drawtextui | +| `"OXLibTextUI"` | ox_lib textui system | ox_lib | + +**OX Lib TextUI Custom Configuration**: + +```lua +Config.Interaction.HelpText.OXLibTextUI = { + Position = "right-center", -- "right-center", "left-center", "top-center", "bottom-center" + Icon = "car", -- FontAwesome or Lucide icon + IconColor = "#3b82f6", -- Hex color + IconAnimation = nil, -- "spin", "pulse", "bounce", etc. + Style = { -- Custom CSS + borderRadius = 8, + backgroundColor = "rgba(59, 130, 246, 0.1)", + borderColor = "#3b82f6" + } +} +``` + + + To use OXLibTextUI, you must also uncomment `shared_script "@ox_lib/init.lua"` + in `fxmanifest.lua`. + + +--- + +### Proximity Prompts Configuration + +```lua +Config.Interaction.ProximityPrompts = { + DrawDistance = 3.0, -- Max distance to see prompt + UsageDistance = 2.0, -- Max distance to use prompt + HoldTime = 600, -- Hold duration in ms (0 = instant) + Key = "E", -- Interaction key +} +``` + +Only used when `Config.Interaction.Type = "proximity"`. + +**Custom Text Overrides**: + +```lua +Config.Interaction.ProximityPrompts.CustomTexts = { + garage = { + objecttext = "Vehicle Garage", + actiontext = "Open Garage Menu" + }, + impound = { + objecttext = "Impound Lot", + actiontext = "Open Impound" + }, + putback = { + objecttext = "Parking Spot", + actiontext = "Store Vehicle" + }, +} +``` + +By default, these use locale entries. Only override if you need specific text. + +--- + +### Target System Configuration + +```lua +Config.Interaction.Target = { + Script = "ox_target" -- "ox_target", "qb-target", "qtarget" +} +``` + +Only used when `Config.Interaction.Type = "target"`. + + + Putback markers will still use normal help text even with target enabled. + + +--- + +### Custom Interaction System + +```lua +Config.Interaction = { + Type = "custom", + CustomSystem = "my_custom_system", +} +``` + +To use a custom interaction system: + +1. Set `Type = "custom"` +2. Set `CustomSystem` to your system's identifier +3. Create a handler in `client/interactions/` (see `client/interactions/example.lua`) + +Your custom system must implement: + +- `GetName()`: Return system identifier +- `Init()`, `Cleanup()`: Lifecycle methods +- `ShowGarageInteraction()`, `HideGarageInteraction()` +- `ShowPutbackInteraction()`, `HidePutbackInteraction()` + +--- + +## Logging Configuration (`configs/logging.lua`) + +### Nearby Player Detection + +```lua +Config.NearbyPlayers = { + selling = 25.0, -- Range for vehicle sales + sharing = 50.0, -- Range for vehicle sharing + webhooks = -1 -- Range for webhook player name lookup (-1 = infinite) +} +``` + +Sets the range (in game units) for detecting nearby players: + +- `selling`: Buyers must be within this range +- `sharing`: Players to share with must be within this range +- `webhooks`: Range for fetching player names in webhook logs (-1 = all online players) + +--- + +### Webhook Configuration + +```lua +Config.Webhook = { + username = "Garage Logs", + communtiyName = "TEST SERVER RP", + communtiyLogo = "", -- URL to logo image + footerIcon = "", -- URL to footer icon + avatar = "", -- URL to webhook avatar + + colors = { + takevehicleoutgarage = 14254773, + takevehicleoutimpound = 14254773, + putvehiclebackin = 14254773, + vehicleshare = 14254773, + transfergarage = 14254773, + vehiclesale = 14254773, + policeimpound = 14254773 + }, + + toggles = { + takevehicleoutgarage = false, + takevehicleoutimpound = false, + putvehiclebackin = false, + vehicleshare = false, + transfergarage = false, + vehiclesale = false, + policeimpound = false + }, + + links = { + takevehicleoutgarage = "", + takevehicleoutimpound = "", + putvehiclebackin = "", + vehicleshare = "", + transfergarage = "", + vehiclesale = "", + policeimpound = "" + } +} +``` + +**Colors**: Decimal color values (use [SpyColor](https://www.spycolor.com/) to convert hex to decimal) + +**Toggles**: Enable/disable specific log types + +**Links**: Discord webhook URLs for each event type + + + Each event type can have its own webhook URL, allowing you to organize logs + into different Discord channels. + + +--- + +## Configuration Best Practices + +### Performance Optimization + +For best performance: + +- Disable debug mode in production +- Use reasonable nearby player ranges (25-50 units) +- Disable webhooks you don't need +- Use `"closest_available"` spawn strategy + +--- + +### Realism Settings + +For maximum realism: + +- `Config.CheckIfVehicleAlreadyExists = true` +- `Config.CheckForVehicleInTheWay = true` +- `Config.AllowTakeoutFromAnyGarage = false` +- `Config.ShowVehiclesFromAllGarages = false` +- `Config.SaveVehicleDamages = true` +- `Config.SaveFuelLevel = true` +- `Config.FixVehicleOnGarage = false` +- `Config.VehicleTransfer.TransferTime = 300` (5 minutes) + +--- + +### Convenience Settings + +For more arcade-style gameplay: + +- `Config.AllowTakeoutFromAnyGarage = true` +- `Config.ShowVehiclesFromAllGarages = true` +- `Config.FixVehicleOnGarage = true` +- `Config.VehicleTransfer.TransferTime = 0` (instant) +- `Config.VehicleTransfer.TransferCost = 0` (free) + +--- + +## Reloading Configuration + +After making changes to configuration files: + +**Option 1**: Restart the resource + +``` +restart zerio-garage +``` + +**Option 2**: Use the reload command (admin only) + +``` +/reloadgarages +``` + + + The `/reloadgarages` command only reloads database configurations (garages, + spawn points, etc.), not the config files. For config file changes, you must + restart the resource. + + +--- + +## Advanced Configuration + +### Framework Detection + +Framework detection is automatic. The system checks for: + +- `es_extended` resource → ESX mode +- `qb-core` resource → QB-Core mode + +No manual configuration needed. See `framework/detect.lua` for implementation details. + +--- + +### Database Configuration + +Database settings are auto-detected based on framework in `framework/server.lua`: + +**ESX**: + +- Table: `owned_vehicles` +- Owner column: `owner` +- Vehicle data column: `vehicle` +- Stored column: `stored` + +**QB-Core**: + +- Table: `player_vehicles` +- Owner column: `citizenid` +- Vehicle data column: `mods` +- Stored column: `state` + +These are abstracted through the `DatabaseConfig` global and should not need modification unless you have a heavily customized framework. + +--- + +## Need Help? + +For configuration assistance, join our [community server](https://discord.zerio-scripts.com) and create a support ticket. diff --git a/pages/garage/description.mdx b/pages/garage/description.mdx index a1ae2a1..982d6a8 100644 --- a/pages/garage/description.mdx +++ b/pages/garage/description.mdx @@ -3,7 +3,7 @@ import { VideoIcon } from "@radix-ui/react-icons"; # Description -Allow players to gather materials and decide themselves what to craft. Instead of just straight up giving them items. +Zerio Garage v3 is a comprehensive vehicle garage system for FiveM servers, providing an advanced and feature-rich solution for managing personal, job, gang, and impound vehicles.
@@ -14,11 +14,88 @@ Allow players to gather materials and decide themselves what to craft. Instead o arrow /> +## Key Features + +### Core Systems + +- **Personal Garages**: Store and retrieve personal vehicles with customizable spawn points +- **Impound Lots**: Retrieve impounded vehicles for a fee +- **Job Garages**: Dedicated garages for job-specific vehicles with grade restrictions +- **Gang Garages**: Gang-exclusive vehicle storage and management +- **Private Garages**: Admin-controlled exclusive garages with custom access lists +- **Housing Integration**: Server-side exports for seamless housing script integration + +### Vehicle Management + +- **Vehicle Transfers**: Transfer vehicles between garages with time delays and costs +- **Vehicle Sales**: Sell vehicles to other players with buyer acceptance flow +- **Vehicle Sharing**: Share vehicle access with other players temporarily +- **Vehicle Nicknames**: Set custom names for your vehicles +- **Favorite Vehicles**: Mark vehicles as favorites for quick access +- **Vehicle Preview**: 3D camera system to preview vehicles before taking them out + +### Job/Gang Features + +- **Customization Presets**: Save and apply vehicle configurations (liveries, extras) +- **Grade Restrictions**: Limit vehicle access by job/gang grade +- **Tracking System**: Monitor when vehicles are taken out and by whom +- **Zerio Bossmenu Integration**: Dynamic vehicle management through bossmenu + +### Police Features + +- **Police Impound Command**: Law enforcement can impound vehicles with custom fees and reasons +- **Impound Logging**: Complete audit trail of impound actions +- **Owner Notifications**: Notify vehicle owners when their vehicles are impounded + +### Admin Tools + +- **In-Game Admin Panel**: Complete CRUD interface for managing garages +- **Placement Editor**: Visual editor for placing garages, spawns, NPCs, and props +- **Plate Changer**: Change vehicle plates with database synchronization +- **Admin Car Command**: Spawn vehicles instantly (ESX-only by default) +- **Audit Logging**: Track all admin actions for security + +### User Experience + +- **Modern Vue 3 UI**: Beautiful, responsive interface built with Vue 3 and TailwindCSS +- **Multiple Interaction Systems**: Support for target systems, proximity prompts, and traditional help text +- **Flexible Text UI**: Support for multiple text UI systems (ox_lib, qb-core, okokTextUI, jg-textui, ESX, CD DrawTextUI) +- **NPC & Prop Decoration**: Add atmosphere with NPCs or props at garage locations +- **Vehicle Type Filtering**: Restrict garages to specific vehicle types (boats only, no planes, etc.) +- **Multi-Language Support**: Full localization system + ## Requirements -- SQL resource: oxmysql, ghmattimysql, mysql-async -- Framework: QBCore / ESX +### Essential + +- **Database**: oxmysql (recommended), ghmattimysql, or mysql-async +- **Framework**: QBCore or ESX +- **FiveM**: Server artifacts build 5181 or higher + +### Optional Dependencies + +- **Target Systems**: ox_target, qb-target, or qtarget (if using target interaction mode) +- **Proximity Prompts**: zerio-proximityprompt (if using proximity interaction mode) +- **Text UI Systems**: ox_lib, okokTextUI, jg-textui, esx_textui, or cd_drawtextui (optional) +- **PolyZone**: Required for zone-based interactions +- **Zerio Bossmenu**: For dynamic job vehicle management + +## Compatibility + +### Frameworks + +- **ESX**: Full support for ESX Legacy and older versions +- **QBCore**: Full support with QB-Phone integration + +### Target Systems + +- ox_target +- qb-target +- qtarget -## Supported +### Interaction Modes -- Target systems: OX_Target, QB-Target +- Normal help text (multiple styles) +- Target systems +- Proximity prompts +- Custom integration support diff --git a/pages/garage/devdocs.mdx b/pages/garage/devdocs.mdx index 619a4de..f5fdaa9 100644 --- a/pages/garage/devdocs.mdx +++ b/pages/garage/devdocs.mdx @@ -1,7 +1,271 @@ # Developer Documentation -Information you as a developer, wanting to extend the resource might want to know will be listed here. +This page contains technical information for developers who want to integrate with or extend zerio-garage. -Such as notable exports, or such. +## Server-Side Exports -If empty, then nothing notable exists at the moment. +### Garage Management + +#### GetGarages + +Retrieves all configured public garages. + +```lua +local garages = exports['zerio-garage']:GetGarages() +``` + +**Returns**: `table` - Array of garage configurations + +**Example**: + +```lua +local garages = exports['zerio-garage']:GetGarages() +for _, garage in ipairs(garages) do + print("Garage: " .. garage.name) + print("Location: " .. json.encode(garage.marker)) +end +``` + +--- + +#### GetImpounds + +Retrieves all configured impound lots. + +```lua +local impounds = exports['zerio-garage']:GetImpounds() +``` + +**Returns**: `table` - Array of impound configurations + +--- + +#### GetJobGarages + +Retrieves all configured job garages. + +```lua +local jobGarages = exports['zerio-garage']:GetJobGarages() +``` + +**Returns**: `table` - Array of job garage configurations + +--- + +#### GetGangGarages + +Retrieves all configured gang garages (QB-Core only). + +```lua +local gangGarages = exports['zerio-garage']:GetGangGarages() +``` + +**Returns**: `table` - Array of gang garage configurations + +**Note**: This export is only available when the framework supports gang garages (QB-Core). + +--- + +### Housing Integration + +#### OpenHousingGarage + +Opens the garage UI for a player, showing their stored vehicles. Used by housing scripts to integrate garage functionality. + +```lua +exports['zerio-garage']:OpenHousingGarage(source, garageId, label, spawns) +``` + +**Parameters**: + +- `source` (`number`): Player server ID +- `garageId` (`string`): Unique garage identifier (used as database key and for transfers) +- `label` (`string`): Display name shown in UI +- `spawns` (`vector4` or `table`): One or more spawn points where vehicles will appear + +**Example**: + +```lua +-- Single spawn point +exports['zerio-garage']:OpenHousingGarage( + source, + "house_123", + "My Beach House", + vector4(-1000.0, 500.0, 30.0, 90.0) +) + +-- Multiple spawn points +exports['zerio-garage']:OpenHousingGarage( + source, + "house_456", + "Mansion Garage", + { + vector4(-1000.0, 500.0, 30.0, 90.0), + vector4(-1005.0, 500.0, 30.0, 90.0), + vector4(-1010.0, 500.0, 30.0, 90.0) + } +) +``` + +**Security Note**: Your housing script must validate access before calling this export. zerio-garage will perform an additional security check but the primary access control is your responsibility. + +--- + +#### StoreHousingVehicle + +Stores the vehicle the player is currently sitting in. Used by housing scripts for garage storage functionality. + +```lua +exports['zerio-garage']:StoreHousingVehicle(source, garageId, label) +``` + +**Parameters**: + +- `source` (`number`): Player server ID +- `garageId` (`string`): Unique garage identifier (must match the one used in OpenHousingGarage) +- `label` (`string`): Display name used in notifications + +**Example**: + +```lua +exports['zerio-garage']:StoreHousingVehicle(source, "house_123", "My Beach House") +``` + +**Note**: The player must be in a vehicle. If not, they'll receive a notification and nothing happens. + +--- + +### Admin Functions + +#### ReloadGarageConfigs + +Reloads all garage configurations from the database and syncs to all clients. + +```lua +exports['zerio-garage']:ReloadGarageConfigs() +``` + +**Use Case**: Call this after manually modifying the database or when you need to force a configuration refresh. + +--- + +#### IsAdmin + +Checks if a player has admin permissions. + +```lua +local isAdmin = exports['zerio-garage']:IsAdmin(source) +``` + +**Parameters**: + +- `source` (`number`): Player server ID + +**Returns**: `boolean` - True if player has admin permissions + +--- + +## Client-Side Exports + +### UI State + +#### IsUIOpen + +Checks if the garage UI is currently open. + +```lua +local isOpen = exports['zerio-garage']:IsUIOpen() +``` + +**Returns**: `boolean` - True if the garage UI is open + +**Use Case**: Use this to prevent other UI interactions while the garage menu is active. + +--- + +## Commands + +### Admin Commands + +| Command | Description | Permission | Framework | +| ------------------- | -------------------------------------------------- | ---------- | ---------- | +| `/garageadmin` | Opens the in-game admin panel for managing garages | Admin | Both | +| `/reloadgarages` | Reloads garage configurations from database | Admin | Both | +| `/admincar [model]` | Spawns a vehicle instantly | Admin | ESX only\* | +| `/changeplate` | Changes a vehicle's plate | Admin | Both | +| `/impound` | Impounds nearby vehicle | Police | Both | + +\* On QB-Core, the `/admincar` command is disabled by default as qb-core provides its own vehicle spawn command. This can be enabled in `configs/features.lua`. + +--- + +## Database Structure + +Zerio Garage v3 uses a modern database structure with multiple tables: + +### Main Tables + +- `zerio_garage_configs`: Stores all garage configurations (garages, impounds, job/gang garages) +- `zerio_garage_spawn_points`: Vehicle spawn points for each garage +- `zerio_garage_putback_points`: Points where players can store vehicles +- `zerio_garage_vehicles`: Static job/gang vehicles (when not using zerio-bossmenu) + +### Feature Tables + +- `zerio_garage_vehicle_transfers`: Active vehicle transfers between garages +- `zerio_garage_vehicle_shares`: Vehicle sharing permissions +- `zerio_garage_active_sales`: Pending vehicle sale transactions +- `zerio_garage_vehicle_sales`: Completed sales history +- `zerio_garage_favorite_vehicles`: Player's favorited vehicles +- `zerio_garage_impound_logs`: Police impound action logs +- `zerio_garage_vehicle_presets`: Job vehicle customization presets +- `zerio_garage_showroom_slots`: Garage showroom display configurations +- `zerio_garage_custom_labels`: Custom vehicle name overrides +- `zerio_garage_private_access`: Private garage access control lists +- `zerio_garage_admin_audit_log`: Admin action audit trail + +### Schema Modifications + +Zerio Garage adds the following column to your framework's vehicle table: + +- `nickname` (varchar): Stores custom vehicle nicknames + +**QBCore**: Adds to `player_vehicles` table +**ESX**: Adds to `owned_vehicles` table + +--- + +## Configuration Files + +The resource uses multiple configuration files organized by functionality: + +- `configs/core.lua`: Core settings (locale, debug, browser locale) +- `configs/garage.lua`: Garage behavior and payment settings +- `configs/vehicle.lua`: Vehicle spawning and condition management +- `configs/features.lua`: Advanced features (sales, transfers, admin commands) +- `configs/interactions.lua`: Interaction system configuration +- `configs/logging.lua`: Webhook and logging settings + +See the [Configuration Guide](/garage/configurationguide) for detailed information. + +--- + +## Custom Interaction Systems + +Zerio Garage supports custom interaction systems. See `client/interactions/example.lua` in the resource for implementation details. + +**Interface Requirements**: + +- `GetName()`: Return unique system identifier +- `Init()`: Initialize the system +- `Cleanup()`: Clean up resources +- `ShowGarageInteraction()`: Display garage interaction +- `HideGarageInteraction()`: Hide garage interaction +- `ShowPutbackInteraction()`: Display putback interaction +- `HidePutbackInteraction()`: Hide putback interaction + +--- + +## Framework API + +Both frameworks are abstracted through a unified API layer located in `framework/client.lua` and `framework/server.lua`. This abstraction layer handles all framework-specific calls internally, making the core code framework-agnostic. diff --git a/pages/garage/faq.mdx b/pages/garage/faq.mdx index abda5fa..d319b4d 100644 --- a/pages/garage/faq.mdx +++ b/pages/garage/faq.mdx @@ -1,38 +1,372 @@ import { Callout } from "nextra/components"; -# Frequently asked questions +# Frequently Asked Questions -A list of frequently asked questions can be seen below. +Common questions and solutions for zerio-garage v3. If your question isn't answered here, visit our [community server](https://discord.zerio-scripts.com) for support! -If this is empty and you have a question, please turn to the support in our [community server](https://discord.zerio-scripts.com) instead! +--- -## Turning off blips for a garage/impound +## General Configuration -This can be done by adding the following to the garage / impound data. +### How do I hide the blip for a garage? + +Blips are enabled by default for all garages. To disable them: + +**Option 1: Via Admin Panel** + +1. Open the admin panel with `/garageadmin` +2. Find the garage you want to modify +3. Toggle off the "Blip Enabled" option + +**Option 2: Via Database** +Set `blip_enabled = 0` for the garage in the `zerio_garage_configs` table. + +--- + +### How do I hide markers for a garage? + +Markers are enabled by default. To disable them: + +**Option 1: Via Admin Panel** + +1. Open the admin panel with `/garageadmin` +2. Find the garage you want to modify +3. Toggle off the "Marker Enabled" option in the marker configuration section + +**Option 2: Via Database** +Set `marker_enabled = 0` for the garage in the `zerio_garage_configs` table. + +--- + +### How do I restrict a garage to specific vehicle types? + +You can use whitelist or blacklist filtering: + +**Whitelist** (only allow specific types): ```lua -hideblip = true, +-- Via data.sql or admin panel +whitelisted_types = '["Boats"]' -- Only boats allowed ``` -## Lock garage to specific vehicle types - -You can use the `whitelistedTypes` value on a garage, to lock it to only those specific vehicle types. +**Blacklist** (allow all except specific types): -You can use the `blacklistedTypes` value on a garage, to lock it to **all** vehicle types, **except** for the ones in the blacklist. +```lua +-- Via data.sql or admin panel +blacklisted_types = '["Boats", "Plane"]' -- Everything except boats and planes +``` - Valid vehicle types: Compacts, Sedans, SUVs, Coupes, Muscle, SportClassic, + **Valid vehicle types**: Compacts, Sedans, SUVs, Coupes, Muscle, SportClassic, Sport, Super, Motorcycle, Offroad, Industrial, Utility, Vans, Bicycles, Boats, Helicopter, Plane, Service, Emergency, Military -## Housing Support + + You cannot use both whitelist and blacklist on the same garage. Whitelist + takes precedence. + + +--- + +## Vehicle Features + +### How do I rename/nickname my vehicle? + +1. Open any garage menu +2. Select your vehicle from the list +3. Click the nickname/rename button in the vehicle details panel +4. Enter your desired nickname and confirm + +Nicknames are stored in your framework's vehicle table and persist across server restarts. + +--- + +### How do vehicle favorites work? + +Mark vehicles as favorites to: + +- Pin them to the top of your vehicle list +- Quickly identify your most-used vehicles + +To mark a vehicle as favorite: + +1. Open any garage menu +2. Select your vehicle +3. Click the star/favorite icon + +Favorites are player-specific and stored in the `zerio_garage_favorite_vehicles` table. + +--- + +### Can I transfer vehicles between garages? + +Yes! The vehicle transfer system allows you to move vehicles between any accessible garages: + +1. Open a garage menu +2. Select a vehicle (it can be stored at any garage) +3. Click the transfer button +4. Choose the destination garage +5. Pay the transfer cost (configurable in `configs/features.lua`) +6. Wait for the transfer to complete (configurable delay) + +**Configuration**: + +```lua +-- In configs/features.lua +Config.VehicleTransfer = { + Enabled = true, + TransferCost = 500, -- Cost in currency + PaymentMethod = "bank", -- "bank" or "cash" + TransferTime = 10, -- Seconds (0 = instant) + AllowImpoundTransfer = true, -- Allow transferring from impound +} +``` + + + When transferring from impound, you must pay both the transfer cost AND the + impound fee. + + +--- + +### How do I share a vehicle with another player? + +The vehicle sharing system allows you to grant temporary access to your vehicles: + +1. Open a garage menu +2. Select your vehicle +3. Click the share button +4. Select the player from nearby players list +5. Confirm the share + +The other player will now see your vehicle in their garage menu (marked as "Shared"). You can revoke access at any time by unsharing. + +**Note**: The range for nearby players can be configured in `configs/logging.lua` under `Config.NearbyPlayers.sharing`. + +--- + +### How do I sell a vehicle to another player? + +The vehicle sale system provides a secure way to sell vehicles: + +1. Open a garage menu +2. Select the vehicle you want to sell +3. Click the sell button +4. Enter the sale price and select a nearby buyer +5. Wait for the buyer to accept +6. The buyer reviews the vehicle and chooses their payment method +7. If accepted, ownership transfers and you receive payment + +**Configuration**: + +```lua +-- In configs/features.lua +Config.VehicleSales = { + Enabled = true, + MaxPrice = 1000000, -- Maximum sale price (0 = unlimited) + RequestCooldown = 60, -- Cooldown between sale requests (seconds) + PaymentMethods = { "bank", "cash" }, + DefaultPaymentMethod = "bank" +} +``` + +--- + +## Job & Gang Garages + +### How do vehicle presets work for job vehicles? + +The preset system allows players to save and quickly apply vehicle configurations: + +1. Take out a job vehicle +2. Customize it (livery, extras) +3. Store it back +4. The system saves your configuration as a preset +5. Next time you take it out, you can select your saved preset + +**Grade Restrictions**: Admins can set minimum grades for specific presets via the admin panel. + +**Configuration**: + +```lua +-- In configs/features.lua +Config.JobVehicles = { + PresetSystem = { + Enabled = true, + MaxPersonalPresets = 0, -- 0 = unlimited + AllowPresetSharing = true, -- Share presets between players + ShareCodePrefix = "ZGP_", + } +} +``` + +--- + +### What's the difference between static vehicles and zerio-bossmenu integration? + +**Static Vehicles** (default): + +- Vehicles are defined in the database (`zerio_garage_vehicles` table) +- Fixed list of vehicles per garage +- Managed via admin panel or SQL +- Best for most servers + +**Zerio Bossmenu Integration**: -### QS-Housing +- Vehicles are managed dynamically through the bossmenu +- Job bosses can add/remove vehicles without admin access +- Vehicles are tied to the business/job's inventory +- Requires zerio-bossmenu resource + +Enable bossmenu integration per garage in the admin panel or set `use_zerio_bossmenu = 1` in the database. + +--- + +### How do I restrict job vehicle access by grade? + +When creating or editing job vehicles in the admin panel or database: + +```lua +-- Allow all grades +grades = '"all"' + +-- Specific grades only (e.g., grades 2 and 3) +grades = '[2, 3]' + +-- Multiple specific grades +grades = '[0, 1, 2]' +``` + +Players must have one of the specified grades to see and take out the vehicle. + +--- + +### Can job vehicles be shared across multiple garage locations? + +Yes! Enable the "Shared Across Locations" option: + +**Via Admin Panel**: + +1. Edit the job garage +2. Enable "Shared Across Locations" + +**Via Database**: + +```sql +UPDATE zerio_garage_configs +SET shared_across_locations = 1 +WHERE name = 'Your Job Garage Name'; +``` + +When enabled: + +- Vehicles taken out from one location can be stored at another +- The `current_garage_id` field tracks where the vehicle currently is +- Perfect for emergency services with multiple stations + +--- + +## Police Features + +### How do police impound vehicles? + +Officers with police jobs can use the `/impound` command: + +1. Stand near the vehicle you want to impound +2. Type `/impound` in chat +3. A UI will open showing: + - Vehicle information (plate, model, owner) + - Fee input (or fixed fee depending on config) + - Reason selection (predefined or custom) + - Impound lot selection (if enabled) +4. Confirm the impound + +The vehicle owner will be notified (if online) and can retrieve it from the impound for the specified fee. + +**Configuration**: + +```lua +-- In configs/features.lua +Config.PoliceImpound = { + Enabled = true, + Command = "impound", + AllowedJobs = { "police", "sheriff" }, + PriceMode = "range", -- "fixed" or "range" + FixedPrice = 500, + MinPrice = 100, + MaxPrice = 5000, + MaxDistance = 10.0, -- Max distance to vehicle + OfficerSelectsImpound = false, -- Let officer choose impound lot + NotifyOwner = true, -- Notify vehicle owner + Reasons = { -- Predefined reasons + "police_impound_reason_illegally_parked", + "police_impound_reason_abandoned_vehicle", + "police_impound_reason_evidence_seizure", + "police_impound_reason_unpaid_fines", + }, +} +``` + +--- + +## Housing Integration + +### How do I integrate zerio-garage with my housing script? + +Zerio-garage provides server-side exports that any housing script can use. Your housing script should: + +1. Handle all access control and permissions +2. Call zerio-garage exports when players interact with house garages + +**Example Integration**: + +```lua +-- In your housing script (server-side) + +-- When player opens house garage +RegisterNetEvent('your-housing:openGarage', function(houseId) + local src = source + + -- YOUR access check + if not PlayerOwnsHouse(src, houseId) then return end + + local house = GetHouseData(houseId) + + -- Call zerio-garage export + exports['zerio-garage']:OpenHousingGarage( + src, + "house_" .. houseId, -- Unique garage ID + house.label, -- Display name + house.garageSpawns -- Spawn point(s) + ) +end) + +-- When player stores vehicle +RegisterNetEvent('your-housing:storeVehicle', function(houseId) + local src = source + + if not PlayerOwnsHouse(src, houseId) then return end + + local house = GetHouseData(houseId) + + exports['zerio-garage']:StoreHousingVehicle( + src, + "house_" .. houseId, + house.label + ) +end) +``` + +See the [housing integration documentation](https://github.com/your-repo/docs/housing-integration.md) for more details. + +--- + +### QS-Housing Integration Change `Config.Garage` in `qs-housing/config/config.lua` to `"zerio-garage"`. -Then create the following file, `qs-housing/client/custom/garage/zerio-garage.lua`, with the following content: +Then create the file `qs-housing/client/custom/garage/zerio-garage.lua` with the following content: ```lua if Config.Garage ~= "zerio-garage" then @@ -95,17 +429,30 @@ Citizen.CreateThread(function() end) ``` -### Other housing scripts +--- + +### Other Housing Scripts + +For housing scripts not listed here, integration is straightforward using our server-side exports. See the [Developer Documentation](/garage/devdocs) for integration examples. -Open a ticket in our [community server](https://discord.zerio-scripts.com) to contact us concerning support for other housing scripts. +If you need assistance, open a ticket in our [community server](https://discord.zerio-scripts.com). -## QB-Phone support +--- -QB-Phone uses exports from `qb-garages` to fetch data for their vehicle app. +## Phone Integration -To fix this error, remove the `@qb-garages/config.lua` shared script from the `qb-phone/fxmanifest.lua` file. +### QB-Phone Support -Then, at the bottom of `qb-phone/fxmanifest`, add: +QB-Phone uses exports from `qb-garages` to fetch garage data for their vehicle app. To integrate zerio-garage: + +**Step 1**: Remove the old dependency from `qb-phone/fxmanifest.lua`: + +```lua +-- REMOVE OR COMMENT OUT: +-- '@qb-garages/config.lua' +``` + +**Step 2**: Add zerio-garage as a dependency at the bottom of `qb-phone/fxmanifest.lua`: ```lua dependencies { @@ -113,8 +460,381 @@ dependencies { } ``` -Then go to the `qb-phone/server/main.lua` file, and add this to the top of it: +**Step 3**: In `qb-phone/server/main.lua`, add this line at the top: ```lua -Config.Garages = exports["zerio-garage"]:getQBPhoneData() +Config.Garages = exports["zerio-garage"]:getQbPhoneData() ``` + +This ensures QB-Phone fetches garage data from zerio-garage instead of qb-garages. + +--- + +## Vehicle Management + +### Why can't I take out a vehicle from a different garage? + +This is controlled by the `Config.AllowTakeoutFromAnyGarage` setting in `configs/garage.lua`: + +- **`false` (default)**: You can only take out vehicles from where they're stored +- **`true`**: Take out any vehicle from any garage (instant access) + +Even if set to `false`, you can still **transfer** vehicles between garages using the transfer system. + +--- + +### Why do I see all my vehicles at every garage? + +This is controlled by the `Config.ShowVehiclesFromAllGarages` setting in `configs/garage.lua`: + +- **`true` (default)**: See all your vehicles in every garage menu +- **`false`**: Only see vehicles stored at the specific garage you're accessing + +This setting affects visibility only. Whether you can take them out depends on `Config.AllowTakeoutFromAnyGarage`. + +--- + +### Can I retrieve a vehicle if it's already spawned in the world? + +By default, no. The `Config.CheckIfVehicleAlreadyExists` setting in `configs/vehicle.lua` prevents duplicate spawns. + +If set to `false`, you can spawn multiple copies of the same vehicle (not recommended for realism). + +--- + +### Are vehicle damages and fuel saved? + +Yes! The following settings control this in `configs/vehicle.lua`: + +```lua +Config.SaveVehicleDamages = true -- Save engine and body damage +Config.SaveFuelLevel = true -- Save fuel level +``` + +When enabled, vehicles are stored with their current condition and restored when taken out. + +--- + +### Can vehicles be repaired automatically when stored/impounded? + +Yes, use these settings in `configs/vehicle.lua`: + +```lua +Config.FixVehicleOnGarage = false -- Repair when storing in personal garage +Config.FixVehicleOnImpound = true -- Repair when retrieving from impound +``` + +--- + +## Admin & Police + +### How do I access the admin panel? + +Use the `/garageadmin` command in-game. You must have admin permissions in your framework. + +The admin panel allows you to: + +- Create, edit, and delete garages +- Manage spawn and putback points +- Configure job vehicles and grades +- View audit logs +- Search vehicles and players +- Manage private garage access lists + +--- + +### How do I use the placement editor? + +The placement editor is an in-game visual tool for positioning garages: + +1. Open the admin panel (`/garageadmin`) +2. When creating or editing a garage, use the "Placement Editor" button +3. Walk to your desired location +4. Follow the on-screen instructions to place: + - Garage marker position + - Spawn points + - Putback points + - NPCs or props +5. Confirm when done + +The editor automatically captures coordinates and sends them back to the admin panel. + +--- + +### What are private garages? + +Private garages are admin-controlled exclusive garages where access is granted on a per-player basis: + +- Create a private garage via the admin panel +- Add player identifiers to the access list +- Only authorized players can see and access the garage + +**Use Cases**: + +- VIP garages for donators +- Special faction garages +- Event-specific temporary garages + +--- + +### How do I change a vehicle's plate? + +Use the `/changeplate` command (admin only): + +``` +/changeplate [oldPlate] [newPlate] +``` + +**Example**: + +``` +/changeplate ABC123 XYZ789 +``` + +This updates: + +- The vehicle's plate in the database +- All related tables (shares, favorites, transfers, impound logs) +- The vehicle's stored properties + + + The new plate must be unique and cannot already exist in the database. + + +--- + +## Interaction Systems + +### How do I change the interaction system? + +Edit `Config.Interaction.Type` in `configs/interactions.lua`: + +**Available Options**: + +```lua +-- Normal help text (press E to interact) +Config.Interaction.Type = "normal" + +-- Target system (ox_target, qb-target, qtarget) +Config.Interaction.Type = "target" +Config.Interaction.Target.Script = "ox_target" -- Specify which one + +-- Proximity prompts (requires zerio-proximityprompt) +Config.Interaction.Type = "proximity" + +-- Custom system +Config.Interaction.Type = "custom" +Config.Interaction.CustomSystem = "my_system_name" +``` + +--- + +### How do I change the help text style? + +If using "normal" interaction type, you can customize the help text style in `configs/interactions.lua`: + +```lua +Config.Interaction.HelpText = { + Enabled = true, + Style = "Floating", -- Options: Default, Floating, QBCore, okokTextUI, + -- JGTextUI, ESXTextUI, CDDrawTextUI, OXLibTextUI +} +``` + +Each style has specific configuration options documented in the config file. + +--- + +## Advanced Features + +### How do I add NPCs or props to garages? + +You can add atmosphere to garages with NPCs or props: + +**Via Admin Panel**: + +1. Edit a garage +2. In the "NPC/Prop Configuration" section: + - Enter an NPC model (e.g., `s_m_m_dockwork_01`) OR + - Enter a prop model (e.g., `prop_parkingpay`) +3. Use the placement editor to position it +4. Save + +**Via Database**: + +```sql +-- Add NPC +UPDATE zerio_garage_configs +SET npc_model = 's_m_m_dockwork_01', + prop_x = -100.0, prop_y = 200.0, prop_z = 30.0, prop_heading = 90.0 +WHERE name = 'Your Garage'; + +-- Add Prop +UPDATE zerio_garage_configs +SET prop_model = 'prop_parkingpay', + prop_x = -100.0, prop_y = 200.0, prop_z = 30.0, prop_heading = 90.0 +WHERE name = 'Your Garage'; +``` + + + You cannot have both an NPC and a prop at the same garage. They are mutually + exclusive. + + +--- + +### How does the vehicle preview camera work? + +When enabled, opening a garage menu will: + +1. Transition the camera to the spawn area +2. Spawn preview vehicles client-side (invisible to other players) +3. Allow you to orbit the camera by right-clicking and dragging + +**Configuration**: + +```lua +-- In configs/features.lua +Config.VehiclePreview = { + Enabled = true, + DefaultDistance = 6.0, -- Camera distance from vehicle + OrbitSensitivity = 2.0, -- Mouse orbit speed +} +``` + +--- + +### How do I set up webhook logging? + +Configure webhooks in `configs/logging.lua`: + +```lua +Config.Webhook = { + username = "Garage Logs", + communtiyName = "My Server", + communtiyLogo = "https://your-logo-url.png", + + toggles = { + takevehicleoutgarage = true, -- Log vehicle takeouts + putvehiclebackin = true, -- Log vehicle storage + vehicleshare = true, -- Log vehicle sharing + transfergarage = true, -- Log transfers + vehiclesale = true, -- Log sales + policeimpound = true, -- Log police impounds + }, + + links = { + takevehicleoutgarage = "https://discord.com/api/webhooks/...", + -- ... add webhook URLs for each event type + } +} +``` + +--- + +## Troubleshooting + +### Vehicles won't spawn - "Vehicle in the way" error + +This is controlled by `Config.CheckForVehicleInTheWay` in `configs/vehicle.lua`. When enabled, the system checks if a vehicle is blocking the spawn point. + +**Solutions**: + +- Clear vehicles from spawn points +- Add more spawn points to the garage +- Set the config to `false` (not recommended) + +--- + +### UI is not opening / showing localhost error + +The `fxmanifest.lua` has a development setting: + +```lua +ui_page "http://localhost:5173" -- Development mode +-- ui_page 'html/index.html' -- Production mode +``` + +For production servers, comment out the localhost line and uncomment the html/index.html line. Or rebuild the UI and let it use the production build automatically. + +--- + +### Locale/translations not working + +1. Check `Config.Locale` in `configs/core.lua` matches your locale file name (e.g., `"en"` for `locales/en.lua`) +2. Check `Config.BrowserLocale` is set correctly (e.g., `"en-US"`, `"en-GB"`, `"de-DE"`) +3. Ensure your locale file exists in the `locales/` folder +4. Restart the resource + +--- + +### How do I enable debug mode? + +Set `Config.Debug = true` in `configs/core.lua`. This will print detailed debug information to the server and client console. + +For PolyZone debugging, also set `Config.DebugPolyZone = true`. + +--- + +## Database & Server + +### What happens to vehicles after a server restart? + +By default, vehicles remain in their current state (out or stored). + +You can force all vehicles back to storage on restart: + +```lua +-- In configs/vehicle.lua +Config.ResetVehiclesAfterRestart = true +``` + +When enabled, all vehicles will be marked as "stored" when the server starts. + +--- + +### Can I customize vehicle name fetching? + +Yes! Zerio Garage supports multiple methods in `configs/vehicle.lua`: + +```lua +Config.NameFetching = "default" -- Options: default, zerio, esx, qb, custom +``` + +- **default**: FiveM natives +- **zerio**: zerio-cardealers database +- **esx**: ESX vehicle table (ESX only) +- **qb**: QB-Core shared vehicles (QB-Core only) +- **custom**: Your own function (define `Config.CustomNameFetch`) + +**Custom Example**: + +```lua +Config.NameFetching = "custom" +Config.CustomNameFetch = function(modelName) + -- Your custom logic here + local myCarDealer = exports['my-cardealer']:GetVehicleName(modelName) + return myCarDealer or modelName +end +``` + +--- + +### How do I customize the spawn point selection strategy? + +Configure in `configs/garage.lua`: + +```lua +Config.SpawnPointStrategy = "closest_available" +-- Options: "closest_available", "first_available", "random_available" +``` + +- **closest_available**: Selects the nearest available spawn point to the player +- **first_available**: Uses the first available spawn in the table order +- **random_available**: Randomly selects from available spawns + +--- + +## Need More Help? + +If your question isn't answered here, join our [community server](https://discord.zerio-scripts.com) for support! diff --git a/pages/garage/installationguide.mdx b/pages/garage/installationguide.mdx index bbf658a..b391dd5 100644 --- a/pages/garage/installationguide.mdx +++ b/pages/garage/installationguide.mdx @@ -1,5 +1,242 @@ +import { Callout, Steps } from "nextra/components"; + # Installation Guide -Installing this resource is as simple as dragging and dropping it into your resources folder, then simply start it. +This guide will walk you through installing zerio-garage v3 on your FiveM server. + +## Prerequisites + +Before installing, ensure you have: + +- A FiveM server running build 5181 or higher +- Either ESX or QB-Core framework installed and configured +- A MySQL database with oxmysql, ghmattimysql, or mysql-async +- PolyZone resource installed + + + Make sure to stop any existing garage resources (qb-garages, esx_vehicleshop + garages, etc.) before installing zerio-garage to avoid conflicts. + + +## Installation Steps + + + +### Download and Extract + +Download zerio-garage from your purchase source and extract it to your server's resources folder: + +``` +resources/ + └── [zerio]/ + └── zerio-garage/ +``` + + + It's recommended to place zerio-garage in a subfolder like `[zerio]` to keep + your resources organized. + + +### Database Setup + +Execute the SQL files in order: + +1. **First**, run `sql/main.sql` to create the database structure +2. **Then**, run `sql/data.sql` to populate with default garages and example data + + + The `data.sql` file includes ready-to-use public garages, impound lots, and + example job garages. You can modify or remove these after installation via the + in-game admin panel or directly in the database. + + +**Using HeidiSQL or similar tool**: + +- Open your database management tool +- Select your server's database +- Execute `main.sql` first +- Execute `data.sql` second + +**Using command line**: + +```bash +mysql -u username -p database_name < sql/main.sql +mysql -u username -p database_name < sql/data.sql +``` + +### Configure the Resource + +Before starting the resource, configure it for your server: + +1. Open `configs/core.lua` and set your locale: + + ```lua + Config.Locale = "en" -- en, de, es, fr, etc. + Config.BrowserLocale = "en-US" -- en-US, de-DE, es-ES, fr-FR, etc. + ``` + +2. Configure interaction type in `configs/interactions.lua`: + + ```lua + Config.Interaction.Type = "normal" -- or "target", "proximity", "custom" + ``` + +3. Review and adjust other settings in the `configs/` folder as needed + +### Add to server.cfg + +Add zerio-garage to your `server.cfg`: + +```cfg +ensure zerio-garage +``` + + + Make sure zerio-garage starts AFTER your framework (ESX/QB-Core) and BEFORE + any resources that depend on it (housing scripts, phone scripts, etc.). + + +**Example load order**: + +```cfg +# Framework +ensure es_extended +# or +ensure qb-core + +# Dependencies +ensure oxmysql +ensure PolyZone + +# Zerio Garage +ensure zerio-garage + +# Housing (if integrating) +ensure qs-housing +``` + +### Start Your Server + +Start or restart your FiveM server. Check the console for successful initialization: + +``` +[zerio-garage] Detected framework: QB-Core +[zerio-garage] Loaded 15 garage configurations from database +[zerio-garage] Garage admin system initialized +``` + +### Test the Installation + +1. Join your server +2. Go to any default garage location (e.g., Legion Square, coordinates: `211.879, -808.111, 30.832`) +3. You should see a garage marker and be able to interact with it +4. Test storing and retrieving a vehicle + + + +## Post-Installation + +### Add Your Own Garages + +You have two options for adding custom garages: + +**Option 1: In-Game Admin Panel** (Recommended) + +1. Use `/garageadmin` command +2. Click "Create New Garage" +3. Use the placement editor to position everything visually +4. Save + +**Option 2: Database** + +1. Insert into `zerio_garage_configs` table +2. Add spawn points to `zerio_garage_spawn_points` table +3. Add putback points to `zerio_garage_putback_points` table +4. Use `/reloadgarages` command or restart the resource + +### Configure Features + +Review the configuration files in the `configs/` folder: + +- Enable/disable vehicle sales, transfers, and sharing +- Configure police impound system +- Set up webhook logging +- Adjust vehicle behavior and damage settings + +See the [Configuration Guide](/garage/configurationguide) for detailed information on all available settings. + +### Set Up Webhooks (Optional) + +If you want Discord webhook logging: + +1. Create webhook(s) in your Discord server +2. Add the webhook URLs to `configs/logging.lua` +3. Enable the log types you want to track + +### Customize Localization (Optional) + +To add or modify translations: + +1. Copy an existing locale file from `locales/` (e.g., `en.lua`) +2. Rename it to your language code (e.g., `de.lua`) +3. Translate all the strings +4. Set `Config.Locale` in `configs/core.lua` to your language code + +## Framework-Specific Setup + +### ESX + +No additional setup required. The resource will automatically detect and integrate with ESX. + +**Optional**: If using an old ESX version, verify the vehicle table name in your database matches `owned_vehicles`. If different, you'll need to adjust `framework/server.lua`. + +### QB-Core + +No additional setup required. The resource will automatically detect and integrate with QB-Core. + +**QB-Phone Integration**: See the [FAQ section on QB-Phone](/garage/faq#qb-phone-support) for integration steps. + +## Troubleshooting Installation + +### "No supported framework detected" error + +**Cause**: Neither ESX nor QB-Core is running on your server. + +**Solution**: + +- Ensure your framework is started before zerio-garage in `server.cfg` +- Check that your framework resource is named correctly (`es_extended` or `qb-core`) + +### Database connection errors + +**Cause**: Database connection issues or SQL resource not running. + +**Solution**: + +- Ensure oxmysql (or your SQL resource) is started before zerio-garage +- Check your database credentials in your SQL resource configuration +- Verify the SQL files executed successfully without errors + +### UI not loading / blank screen + +**Cause**: UI path is set to development mode in `fxmanifest.lua`. + +**Solution**: + +- Comment out `ui_page "http://localhost:5173"` +- Uncomment `ui_page 'html/index.html'` +- Restart the resource + +### Markers not showing + +**Cause**: Markers might be disabled by default or PolyZone is missing. + +**Solution**: + +- Check that PolyZone is installed and started +- Verify markers are enabled in garage configuration (`marker_enabled = 1`) +- Check if you're close enough to the garage location + +## Need Help? -Make sure to execute the SQL file too. +If you're still having issues, join our [community server](https://discord.zerio-scripts.com) and create a support ticket.