# Gang Garages

The resource offers built-in garage system for gang-members to use or you can use your own garage system.

## Configuration

1. Navigate to `t1ger_gangsystem/config.lua`.
2. Find the table/option called `GangMarkers`.
3. Go through and set the config options to your preferences (read the end-line text comments).&#x20;
4. Set `useBuiltInGarage = true` if you want to use the built in system or set to `false` and use your own garage system.

## Built In Garage

{% hint style="danger" %}
If you do not have any experience with FiveM/LUA coding, please do not engage in this. Seek help from experienced developers.
{% endhint %}

The built-in-garage is a very basic garage system that allows:

* Getting all player owned vehicles and spawn the selected one.
* Store the current vehicle player is using.

### &#x20;Get Player Vehicles

You may find it necessary to customize the built-in garage to fetch vehicles based on a few criteria such as stored/parked state and so on.&#x20;

1. Navigate to `t1ger_gangsystem/client/main.lua`.
2. Find the event named:&#x20;

   ```lua
   'gangsystem:client:getPlayerVehicles'
   ```
3. These are the keys you can use ***(make sure you have updated t1ger-lib with correct values for those keys. See*** [T1GER Library](/resources/t1ger-library.md#player-owned-vehicles) ***for instructions)***:

   ```lua
   vehicle.plate -- plate of the vehicle
   vehicle.props -- vehicle properties
   vehicle.type -- vehicle type
   vehicle.job -- vehicle job
   vehicle.stored -- vehicle stored/state/parked state
   vehicle.garage -- garage of the vehicle
   vehicle.impound -- is vehicle in impound
   vehicle.sezied -- is vehicle seized?
   vehicle.model -- vehicle model
   vehicle.name -- vehicle name
   vehicle.category -- vehicle category
   vehicle.fuel -- fuel level of vehicle
   vehicle.egine -- engine level of vehicle
   vehicle.body -- body level of vehicle
   ```
4. Now inside the code for the event you can add checks. The checks have to be added as an if statement before the `table.insert()` function is called.
5. See my commented-out example inside the event (`data.marker.id` is a unique name created for each gang garage and you can use this for garage-specific systems).

   <figure><img src="/files/W7R9NgAU2Pr2aP7yWgtI" alt=""><figcaption><p>Checks for garage, stored, type and job is used in this example.</p></figcaption></figure>

### Update Owned Vehicle

You may find it necessary to customize the event for updating a specific owned vehicle when the respective vehicle is either spawned from a garage or stored in a garage.&#x20;

By default the resource uses a `TriggerServerEvent` to T1GER Library to update stored, garage and props when a vehicle is spawned/stored. If you havent updated the function to your server settings, please refer to: [T1GER Library](/resources/t1ger-library.md#update-owned-vehicle).

{% code title="The name of the TriggerServerEvent for updating owned vehicle:" %}

```lua
't1ger_lib:updateOwnedVehicle'
```

{% endcode %}

There are two entries of those in this resource. Navigate to: `t1ger_gangsystem/client/main.lua`.

The first looks like this:&#x20;

{% code title="Storing a vehicle into a gang garage:" %}

```lua
TriggerServerEvent('t1ger_lib:updateOwnedVehicle', true, marker.id, props)
-- true is the stored state, in this case vehicle is being stored into a garage.
-- marker.id (is the unique garage name of the gang).
-- props is the vehicle properties.
```

{% endcode %}

The second entry looks like this:&#x20;

{% code title="Spawning a vehicle from a gang garage:" %}

```lua
TriggerServerEvent('t1ger_lib:updateOwnedVehicle', false, nil, props)
-- false is the stored state, in this case vehicle is being såawned from the garage.
-- nil (garage), vehicle is no longer in any specific garage.
-- props is the vehicle properties.
```

{% endcode %}

You can change the `nil` value to `data.marker.id` if  you want to keep the garage of the vehicle when spawning it but logically it makes no sense. When vehicle is spawned the attached garage should be set to `nil`.

{% hint style="warning" %}
If your garage system / table column for stored/state/parked uses other value than a boolean, let's say an INT. Then update the true/false parameter in the TriggerServerEvent to an INT or whatever value it may be.&#x20;

Make sure to update the Lib.UpdateOwnedVehicle() function from T1GER Library accordingly, so it uses the parsed values instead of boolean. See [T1GER Library](/resources/t1ger-library.md#update-owned-vehicle) to find the function in T1GER Library.
{% endhint %}


---

# 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://docs.t1ger.net/resources/t1ger-gang-system/gang-garages.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.
