# Usage

## TLDR

* `/park` to parkan owned vehicle
* Target a parked vehicle to unlock/check it
* `/parkedlist` to view list of vehicles and where they are
* `/impound` to send a vehicle to police impound
* `/depot` to send a vehicle to impound depot
* `/impoundlist` to get list of vehicles in impound of depot (when standing in its zone)
* Has option for radialmenu button addition for these options

***

## The Main Systems

### Auto Cleanup

* The AutoCleanup event is run on server start + every time a player connects
* This is to reduce lag of a loop constantly checking for expiration
* This is specified by `Config.Main.ClearDays`, after this amount of days of a vehicle being parked
* It is sent to either the vehicle depot, or hides it (needing the user to go to the location and unhide it to unpark it again)

### Framework Compatability

* This default attempts to check for what framework is running and make use of its SQL to save the parked info about vehicles
* You can hard set it if you've decided to rename your core framework folder.

***

## Config file

### Main.SpawnDist

* This is the max distance a parked vehicle will appear at, these are based on polyzones so you can raise it, but a lot of vehicles at onces may cause issues for some players
* Default: `75.0`

### Main.ClearDays

* This option defines how many days a car will stay "parked" before it is removed or hidden
* Default: `30`

### Main.ParkedLimit

* Limit how many cars a player can park, this is to help the issue of the players who love to collect cars
* There shouldn't be an issue, with a large amount of cars, but I can see too many being a bit overwhelming for lower end pc's
* Setting this to `ParkedLimit = nil,` removes this limit completely
* Default: `25`

### Main.SendToDepot

* If `true`, when the `ClearDays` limit is reached for a vehicle, it will send it to the vehicle depot
* If false, it will send the car back to the last player garage used.

### Main.HideNotRemove

* If true, this will override the `SendToDepot` setting
* This changes how the system works so that a car is "hidden" instead of sent to the garage or depot
* When hidden the player will need to go to the location of the car and view their parked car list and choose "Show Vehicle"
  * This bring the car back and also "repark" the car, resetting the timer for it to be hidden again

<div align="left"><figure><img src="https://i.imgur.com/KQ6mHpG.png" alt=""><figcaption></figcaption></figure></div>

### Restrictions.OwnOnly

* This simply allows players to park other peoples owned vehicles (they still need to be bought/owned vehicles)
* `true` = can only park your own vehicles

### Restrictions.CarParks

* If you have enabled `Restrictions.CarParks` in the config, the players will ONLY be able to park in specific polyzones
* These are vec2 polyzones specified in `locations/*.lua`

### Restrictions.RedZones

* If true, the locations set in `locations/redzones.lua` will stop players parking in those areas specifically

### Restrictions.BoatParking

* If true, this allows the ability to park owned boats, anchoring them in place
* Also enables the boat impound

### Restrictions.canSummon

* If true, gives players an option in their `parkedlist` menu to have the vehicle driven to them by an npc

### Restrictions.canSummonDist

* Minimum distance away a player needs to be before the summon option is shown
* Default: `200`

### Restrictions.canSummonCost

* The cost for summoning their vehicle, can be set to 0 for "free"
* Default: `1000`

### Restrictions.canTow

* This adds an option in the job/police check menu to allow for calling for a tow of the vehicle
* This requires manually setting up in `compat/generalCompat.lua`

### Restrictions.canRemoveClamp

* This allows players to "illegally" remove a clamp from their vehicle
* This is intended to call the police
* This requires manually setting up in `compat/generalCompat.lua`

### Restrictions.canRemoveClampItem

* The item required to remove a clamp "illegally"
* When the user has this item, it will show an option when they target a clamped" vehicle

### Job Setup

* In the `Config.Restrictions` there is a table called `Job`
* This handles which job can do what to parked vehicles
* This should be setup completely depending on what you want for your server

```lua
JobRestrictions = {
	["mechanic"] = { 			-- the Job role's name
		Clamp = true, 			-- Enable if this job role can add or remove wheel clamps to the vehicle
		Impound = true,			-- Enable this to let the job role send the car to the "Police" impound
		Depot = true,			-- Enable this to allow them to send to the public vehicle depot
		Unlock = true,			-- Enable this to allow this job role to "unpark" the vehicle (suggested for things like vehicle search warrants)
	},
}
```

### CarParks

* These are located in `locations/carparks.lua`
* These are the locations you can only park if `Restrictions.CarParks` is true
* If a job table is added it will make it job locked
  * Not adding the job table to the zone will make it usable by anyone

```lua
CarParks = {
    ['pdfront'] = { 				-- Random name just to help you track what/where it is
		job = { ["police"] = 0, }, 	-- You can job restrict parking lots
		zone = { 					-- This is your poly zone, created with /pzcreate
			vec2(405.13595581054, -998.57788085938),
			vec2(410.59521484375, -1002.8664550782),
			vec2(410.91711425782, -979.44134521484),
			vec2(405.4065246582, -974.57928466796),
		},
		bottom = 28.0, 				-- The bottom of the zone
		top = 31.0, 				-- The highest point of the zone
    },
}
```
