# Installation

### 🛠️ Step 1: Put in your resouces file

1. Download resouces `kc_garage`
2. Extract file and put `kc_garage` in your resource files

### 🛠️ Step 2: Insert SQL Query&#x20;

* If you have already used `esx_garages`, you can use the old database by replacing `esx-database-add.sql`.
* If you have already used `qb-garages` you can use the old database by replacing `qb-database-add.sql`.
* If you want to create a new database you can replace `esx-database-new.sql` for `esx` or `qb-database-new.sql` for `qb-core`. **This method can delete all the vehicles the player owns.**

### 🛠️ **Step 3:** Conifg.lua Configuration

* You can edit the fields in `shared/config.lua` to the infrastructure you use.

```lua
Config = Config or {}

-- [[ FRAMEWORK ]] --
Config.Framework              = 'esx' -- Framework 
Config.FrameworkFolder        = 'es_extended' -- Framework folder
Config.NewESX                 = true -- if you not use new esx set false
Config.NewQb                  = true -- if you not use new qb set false

Config.Locale                 = 'en' -- locale
Config.CheckForUpdates        = true -- check if a new update
Config.Debug                  = false -- print debug
Config.Notify                 = 'lib' -- 'esx', 'qb', 'lib', 'custom' you can custom notify in mainAPI.lua line 20
Config.TextUI                 = 'lib' -- use 'esx' or 'lib'  or 'qb'
Config.AccountType            = 'money' -- account type for default qb = 'cash'
Config.RadialMenu             = false -- you can use qb or lib radial menu or if not use radial menu set false
Config.OxTarget			          = GetResourceState("ox_target") ~= 'missing'

Config.UseAnim                = true -- use animation if open garages menu
Config.AutoTpToVeh            = false -- auto teleport player to vehicles if player spawn vehicle 
Config.AutoLockVeh            = false -- auto lock vehilce if vehilce has spawn
Config.AutoDelVeh             = true -- auto delete vehicle 
Config.DelVehTimer            = 60 -- auto delete vehicle timer to send notif
Config.DelVehInSafeZone       = true -- include auto delete vehicle in safe zone
Config.SaveVehiclesInterval   = 5 -- auto save vehicles properties in seconds
Config.UseKMH                 = true -- set false if you not use KMH
Config.CmdDelVeh              = 'asuransi' -- command for delete vehicles in word
Config.CmdLockVeh             = 'kunci' -- command for lock vehicles
Config.LockKeyVehicle         = 'U' -- keybind for lock vehicles
Config.CmdGiveKey             = 'givekey' -- command for give keys

Config.DeleteVehiclesAt = { -- Automatic clock setting to delete or impound vehicles if there is no player inside. format 24h
-- { ['h'] = hh, ['m'] = mm },
	{ ['h'] = 00, ['m'] = 00 },
	{ ['h'] = 03, ['m'] = 00 },
	{ ['h'] = 09, ['m'] = 00 },
	{ ['h'] = 15, ['m'] = 00 },
}

Config.SafeZones = { -- If the vehicle is within the safe zone, it will not be deleted.
	{ ['x'] = -44.155646565, ['y'] = -1100.155646565, ['z'] = 26.267009735108, ['radius'] = 50.0},
	{ ['x'] = -1688.43811035156, ['y'] = -1073.62536621094, ['z'] = 13.1521873474121, ['radius'] = 200.0},
	{ ['x'] = -2195.1352539063, ['y'] = 4288.7290039063, ['z'] = 49.173923492432, ['radius'] = 150.0},
}

Config.DefaultImpound   = { -- default vehicles storage if vehicle out garages
  ['car'] = 'SandyShores',
  ['aircraft'] = 'SandyShoresAir'
}

Config.DefaultJobImpound   = { -- storage of the default vehicle if the vehicle is confiscated by officers 
  ['car'] = 'Samsat',
  ['aircraft'] = 'SandyShoresAir'
}

Config.GroupAdminList= { -- Admin list for to use Config.CmdVehDelete
  'group.god',
  'group.dev',
  'group.moderator',
  'group.headadmin',
  'group.superadmin',
  'group.admin',
}

Config.Peds = { -- Peds List
  garage = 'CSB_TrafficWarden',  -- Garages
  impound = 's_m_y_construct_01', -- Impounds
  policeImpound = 'IG_ProlSec_02'       -- PoliceImpounds
}

Config.VehicleFee = { -- fees for removing vehicles in garages or impounds, if set to 0 the player does not pay
  garage = { -- Garage Fee
    [0] = 0, -- Compacts
    [1] = 0, -- Sedans
    [2] = 0, -- SUVs
    [3] = 0, -- Coupes
    [4] = 0, -- Muscle
    [5] = 0, -- Sports Classics
    [6] = 0, -- Sports
    [7] = 0, -- Super
    [8] = 0, -- Motorcycles
    [9] = 0, -- Off-road
    [10] = 0, -- Industrial
    [11] = 0, -- Utility
    [12] = 0, -- Vans
    [13] = 0, -- Cylces
    [14] = 0, -- Boats
    [15] = 0, -- Helicopters
    [16] = 0, -- Planes
    [17] = 0, -- Service
    [18] = 0, -- Emergency
    [19] = 0, -- Military
    [20] = 0, -- Commercial
    [21] = 0 -- Train 
  },

  impound = { -- Impound Fee
    [0] = 15000, -- Compacts
    [1] = 15000, -- Sedans
    [2] = 15000, -- SUVs
    [3] = 15000, -- Coupes
    [4] = 15000, -- Muscle
    [5] = 15000, -- Sports Classics
    [6] = 15000, -- Sports
    [7] = 15000, -- Super
    [8] = 10000, -- Motorcycles
    [9] = 15000, -- Off-road
    [10] = 15000, -- Industrial
    [11] = 15000, -- Utility
    [12] = 15000, -- Vans
    [13] = 0, -- Cylces
    [14] = 50000, -- Boats
    [15] = 50000, -- Helicopters
    [16] = 50000, -- Planes
    [17] = 15000, -- Service
    [18] = 0, -- Emergency
    [19] = 15000, -- Military
    [20] = 15000, -- Commercial
    [21] = 0 -- Train 
  }
}

Config.Blips = {
  ['Garages'] = { -- blips for garage
    car = {
      Sprite = 357,
      Colour = 3,
      Display = 2,
      Scale = 0.8
    },
    aircraft = {
      Sprite = 359,
      Colour = 3,
      Display = 2,
      Scale = 0.8
    },
    boat = {
      Sprite = 356,
      Colour = 3,
      Display = 2,
      Scale =  0.8
    }
  },

  ['Impounds'] = { -- blips for impound
    car = {
      Sprite = 477,
      Colour = 51,
      Display = 2,
      Scale = 0.7
    },
    aircraft = {
      Sprite = 359,
      Colour = 51,
      Display = 2,
      Scale = 0.8
    },
    boat = {
      Sprite = 356,
      Colour = 51,
      Display = 2,
      Scale =  0.8
    }
  }
}

-- [[ FRAMEWORK ]] --

Core = nil

pcall(function()
	while Core == nil do
    if Config.Framework == 'esx' then
      if Config.NewESX then
        Core = exports[Config.FrameworkFolder]:getSharedObject()
      else
        TriggerEvent('esx:getSharedObject', function(obj) Core = obj end)
      end
    elseif Config.Framework == 'qb' then
      if Config.NewQb then
        Core = exports[Config.FrameworkFolder]:GetCoreObject()
      else
        TriggerEvent('QBCore:GetObject', function(obj) Core = obj end)
      end
    end
    Citizen.Wait(10)
	end 
end)


function GroupDigits(value)
	local left, num, right = string.match(value, '^([^%d]*%d)(%d*)(.-)$')
	return left .. (num:reverse():gsub('(%d%d%d)', '%1' .. ','):reverse()) .. right
end
```

### 🛠️ **Step 4:** Garages.lua Configuration

* You can add a garages anywhere. Open `shared/garages.lua` to add a new garage

Public Garage:

```lua
['Legion'] = { -- Garage key name
  Label = 'Garkot', -- Garage label name
  Type = 'car', -- Vehicles Type
  Blip = true, -- Show blip ?
  Players = false, -- Only selected players can access || prams: boolean or table
  Jobs = false, -- Only selected jobs can access || prams: boolean or table
  Coords = vector4(-282.7397, -888.6456, 31.0806, 73.9637), -- For ped spawn if you use peds
  SpawnPoint = {
    vector4(-285.6491, -888.0939, 31.0806, 166.4453), -- Spawn point 1
    vector4(-289.2811, -887.3295, 31.0806, 169.8648), -- Spawn point 2
    vector4(-292.9691, -886.3055, 31.0806, 168.2578), -- Spawn point 3
    vector4(-296.4071, -885.5869, 31.0806, 167.0156), -- Spawn point 4
    vector4(-300.0922, -884.8438, 31.0806, 167.7881), -- Spawn point 5
    vector4(-303.7151, -883.9635, 31.0806, 165.1761), -- Spawn point 6
  },
  DeletePoint = {
    Pos = vector3(-293.78, -886.32, 30.18),  -- Coords delete point zone
    Size = vector3(20, 6, 5), -- Size box zone
    Rotation = 348 -- Rotation zone
  }
}
```

Private Garage:

```lua
['HachiGarage'] = { -- Garage key name
  Label = 'Hachi Garage', -- Garage label name
  Type = 'car', -- Vehicles Type
  Blip = false, -- Show blip ?
  Players = { -- Only selected players can access || prams: boolean or table
    'steam:xxxxxxxxxxxx',
  },
  Jobs = false, -- Only selected jobs can access || prams: boolean or table
  Coords = vector4(-100.3831, 819.2451, 235.7249, 7.1012),  -- For ped spawn if you use peds
  SpawnPoint = {
    vector4(-104.9789, 824.1717, 235.7252, 9.1065),  -- Spawn point 1
  },
  DeletePoint = {
    Pos = vector3(-104.98, 824.17, 235.73),  -- Coords delete point zone
    Size = vector3(10, 10, 5),  -- Size box zone
    Rotation = 15 -- Rotation zone
  }
},
```

Jobs Garage:

```lua
['RSAir'] = {  -- Garage key name
  Label = 'Rumah Sakit Air', -- Garage label name
  Type = 'aircraft',  -- Vehicles Type
  Blip = false,  -- Show blip ?
  Players = false, -- Only selected players can access || prams: boolean or table
  Jobs = {  -- Only selected jobs can access || prams: boolean or table
    'ambulance',
  },
  Coords = vector4(-675.1924, 327.1154, 140.1467, 88.0828), -- For ped spawn if you use peds
  SpawnPoint = {
    vector4(-686.8148, 326.8840, 140.1467, 179.3648),   -- Spawn point 1
  },
  DeletePoint = {
    Pos = vector3(-687.07, 323.44, 140.15),   -- Coords delete point zone
    Size = vector3(15, 15, 5),  -- Size box zone
    Rotation = 0 -- Rotation zone
  }
}
```

### 🛠️ **Step 5: Impound**.lua Configuration

* You can add a impounds anywhere. Open `shared/impounds.lua` to add a new impound

```lua
['SandyShores'] = { -- Impound key name
  Label = 'Asuransi', -- Impound label
  Type = 'car', -- vehicles type
  Blip = true, -- show blip ?
  Jobs = false, -- Only selected jobs can access || prams: boolean or table
  Coords = vector4(252.6120, 2595.9448, 44.8955, 15.9485), -- Spawn peds coords
  SpawnPoint = {
    vector4(258.2920, 2592.3401, 44.6332, 9.6964) -- Spawn vehilce coords
  }
},

['SandyShoresAir'] = {
  Label = 'Asuransi Udara',
  Type = 'aircraft',
  Blip = true,
  Jobs = false,
  Coords = vector4(1743.8893, 3296.8372, 41.1287, 193.3046),
  SpawnPoint = {
    vector4(1739.1770, 3281.5996, 41.0936, 11.3545)
  }
},

['Samsat'] = { -- if for jobs keywords should start with the word Jobs
  Label = 'Samsat',
  Type = 'car',
  Blip = true,
  Jobs = {['police'] = 0},
  Coords = vector4(409.1168, -1623.0258, 29.2919, 230.4279),
  SpawnPoint = {
   vector4(416.9999, -1627.8965, 29.0, 137.3000),
   vector4(419.6365, -1629.6110, 29.0, 135.3693),
  }
},
```

### 🛠️ Step 6:  Start the resouce

* Go to `server.cfg` and replace `ensure kc_garage`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kucluck.gitbook.io/docs/garage/kc-garage-v1/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
