Model Reference
Warning
If you are not an advanced user please skip this page otherwise it might confuse you.
The following tables will be created.
Info
If you edit these tables directly you need to restart the script to load the changes.
Garage
This table holds all the created garages. These include indoor and outdoor garages.
Note
Not all the data is stored here. The other part is stored as metadata in the GarageMetadata table.
Table name: rn-garages
Columns
| Name | Type | Default value | Constraints & Validations | Description |
|---|---|---|---|---|
| id | Integer (unsigned) | PRIMARY KEY AUTO_INCREMENT |
Database identifier | |
| displayName | String | NOT NULL | Display name of the garage used in UI's | |
| garageType | GarageType | String | NOT NULL | Type of garage | |
| vehicleType | VehicleType | NOT NULL | What type of vehicle can park in this garage | |
| parkingType | ParkingType | NOT NULL | What type of parking does this garage offer | |
| parkingCost | Integer | null | NULL | The cost of parking, can be one-time payment or per x time. Depends on parkingCostInterval.Keeping this field null means free parking. |
| parkingCostInterval | Integer | null | NULL | The interval of the parking cost in minutes. Keeping this field null means one-time payment (or free parking if parkingCost is also null) |
| maxParkingDuration | Integer | null | NULL | The maximum time in minutes a vehicle is allowed to park here in a row. If they exceed this time the logic will eventually trigger a towing event. |
| exportRowIdentifier | String | NOT NULL UNIQUE |
Used to identify rows when syncing database data. Used only if syncDatabaseContent in the server config is not set to false.See more info about this on the page Configuration. |
GarageMetadata
We use a base model for Metadata models. To learn more see Metadata database model.
Metadata keys
| Name | Type | Is allowed to be NULL | Description |
|---|---|---|---|
| entrance | Vector4 | No | Used by GarageType indoor only.Coordinates of the garage entrance for peds. |
| car_entrance | Vector4 | No | Used by GarageType indoor only.Coordinates of the garage entrance for vehicles. |
| car_exit | Vector4 | No | Used by GarageType indoor only.Coordinates of the garage exit for vehicles. |
| interior_id | Integer (unsigned) | No | Used by GarageType indoor only.Which interior this garage uses. It's a foreign key that leads to GarageInterior. |
| blip_pos | Vector3 | No | Used by GarageType outdoor only..The coordinates of where the blip positon of this garage should be set. |
| polyzone | JSON (Integer[]) | No | Used by GarageType outdoor only..An array with all the poly points making up the polyzone. |
| max_parking_spots | Integer | No | Used by GarageType outdoor only..The amount of maximum parking spots. |
| max_parking_spots | Integer | No | Used by GarageType outdoor only..The amount of maximum parking spots. |
| allowed_jobs | JSON (String[]) | Yes | Used by ParkingType job only.An array with jobs that are allowed to enter and park their car in this garage. |
| tracking_proxy | Vector3 | Yes | If set this proxies the position of parked vehicles for the owners to the set location. Example usage: The police impounds a vehicle because of a crime commited, you wouldn't want the owner of the vehicle to find out where the vehicle is parked while the investigation is ongoing. So you can proxy the location for the owner to, for example, the police station. |
| cb_can_enter | String | Yes | A server callback event name that will be triggered when a player tries to enter the garage to check if this event thinks they have access or not, this is an extra check that is checked last. See Callbacks for more information. |
| cb_can_manage | String | Yes | A server callback event name that will be triggered when a player tries to manage the garage to check if this event thinks they have access or not, this is an extra check that is checked last. See Callbacks for more information. |
| event_name_towing_needed | String | Yes | A custom server event name that will be triggered when a tow truck is required. If not filled in, it will just trigger the default event that you can listen to. |
| rent_type | RentType | Yes | The rent type of this garage. |
| owner | String | Yes | The framework ID of the player who owns this garage. |
GarageInterior
Garage interiors for the indoor garages are stored here.
Table name: rn-garages_interior
Columns
| Name | Type | Default value | Constraints & Validations | Description |
|---|---|---|---|---|
| id | Integer (unsigned) | PRIMARY KEY AUTO_INCREMENT |
Database identifier | |
| name | String | NOT NULL | Name of this interior. | |
| exit | Vector3 | NOT NULL | Coordinates of where the exit is located within the interior. | |
| internal_name | String | null | NULL | Name used in debug. |
Scrapyard
All scrapyards are stored here.
Table name: rn-garages_scrapyards
Columns
| Name | Type | Default value | Constraints & Validations | Description |
|---|---|---|---|---|
| id | Integer (unsigned) | PRIMARY KEY AUTO_INCREMENT |
Database identifier | |
| displayName | String | NOT NULL | Name of this scrapyard. | |
| scrapPos | Vector3 | NOT NULL | Coordinates of where the interactable position is going to be. | |
| npcSpawnPoint | Vector4 | NOT NULL | Coordinates of where the NPC will spawn from. | |
| npcModel | String | NOT NULL | Ped model name you want the NPC to have. |
ParkingSpot
Parking spots related to the interior type.
Table name: rn-garages_parking_spots
Columns
| Name | Type | Default value | Constraints & Validations | Description |
|---|---|---|---|---|
| id | Integer (unsigned) | PRIMARY KEY AUTO_INCREMENT |
Database identifier | |
| interiorGarageId | Integer (unsigned) | INDEX (relation to GarageInterior) NOT NULL |
Database identifier of the garage interior this parking lot is part of. | |
| vehicleType | VehicleType | null | NULL | A vehicle type filter. Only allow given vehicle types to park in this spot. |
| pos | Vector4 | NOT NULL | Position of the parking spot. |
GarageAccess
Access to garages are stored here.
Table name: rn-garages_access
Columns
| Name | Type | Default value | Constraints & Validations | Description |
|---|---|---|---|---|
| id | Integer (unsigned) | PRIMARY KEY AUTO_INCREMENT |
Database identifier | |
| garageId | Integer (unsigned) | INDEX (relation to Garage) NOT NULL |
The database identifier of the garage this access entry belongs to. | |
| accessType | GarageAccessType | NOT NULL | Type of access. See the type for more information. | |
| accessValue | String | NOT NULL | Based on accessType. See GarageAccessType of what to expect this to be. |
|
| accessGrade | Number | null | NULL | If applicable, the minimum grade an employee or gang member needs to have in order to enter this garage. |
| parkingLimit | Number | null | NULL | The amount of vehicle this access target is allowed to park. Empty is unlimited. |
| allowedToManage | Boolean | false | NOT NULL | If this access target is allowed to manage the garage or not. |
PlayerVehicle
All player vehicles will be stored here.
This doesn't change your framework based player vehicle table at all. We use our own table to store player vehicles.
Table name: rn-player-vehicles
Columns
| Name | Type | Default value | Constraints & Validations | Description |
|---|---|---|---|---|
| id | Integer (unsigned) | PRIMARY KEY AUTO_INCREMENT |
Database identifier | |
| ownerFrameworkId | String | NOT NULL | The framework id of the player who owns the vehicle. | |
| model | String | NOT NULL | Either the named vehicle model or stringified hash of the vehicle model. | |
| plate | String(8) | NOT NULL | The plate text of the vehicle. Limit of 8 characters, only letters and numbers are allowed, no spaces either. Failing to follow these limitation may result in the script not recognizing vehicles and other weird things. |
|
| status | VehicleStatus | "available" | NOT NULL | The current status of the vehicle. |
| parkedAt | Integer (unsigned) | null | INDEX (relation to Garage) NULL |
The garage the vehicle is currently parked at. Null = not parked in a garage. |
| parkedInSpot | Integer (unsigned) | null | INDEX (relation to ParkingSpot) NULL |
The spot the vehicle is currently parked in. Is only set if parked in an indoor garage. |
| parkedWhen | Timestamp | null | NULL | A unix timestamp of when the vehicle was parked. |
| impounded | Boolean | false | NOT NULL | If the vehicle is impounded or not. |
| impoundedAt | Timestamp | null | NOT NULL | A unix timestamp of when the vehicle was impounded. |
| lastPos | Vector4 | NOT NULL | The last known position of the vehicle. | |
| mods | JSON | {} | NOT NULL | An object with all type of vehicle mods installed in the vehicle. We reused QBCore's vehicle mod reading and setting for this so if you'd like to know more check out QBCore's resources for more info. It doesn't matter what framework you use, we implemented the functionality in rn-bridge and made the code standalone. |
ParkingRent
All interval parking rents are stored here.
Table name: rn-garages_parking-rent
Columns
| Name | Type | Default value | Constraints & Validations | Description |
|---|---|---|---|---|
| id | Integer (unsigned) | PRIMARY KEY AUTO_INCREMENT |
Database identifier | |
| garageId | Integer (unsigned) | INDEX (relation to Garage) | Database identifier of the garage this parking rent is connected to. | |
| billedPlayer | String | NOT NULL | Framework id of the player that this rent is for. | |
| billTo | ValidBankingAccountInput | NOT NULL | Bank details the bill needs to be paid from. | |
| receiver | ValidBankingAccountInput | NOT NULL | Bank details that receives the payment. | |
| agreedAmount | number | NOT NULL | The amount the player has to pay. | |
| lastInvoiceAt | number | NOT NULL | A unix timestamp of when the last successful invoice was sent. | |
| nextInvoiceAt | number | NOT NULL | A unix timestamp of when the next invoice will be sent. |