# Creating a Location

This guide will explain the location file, and explain how to create a new one

{% hint style="info" %}
### I highly recommend turning on debug mode in the config to help visualize the zones better when editing
{% endhint %}

We'll start with a preset location:

<details>

<summary><code>gabz_tuners_mech.lua</code></summary>

```lua
Locations = Locations or {}

--[[ GABZ LS TUNER SHOP ]]--
--[[ Gabz - https://fivem.gabzv.com/package/4724521 ]]--

Locations["lstuners_gabz"] = {
	Enabled = false,
	autoClock = { enter = false, exit = false, },
	job = "mechanic",
	label = "Tuner Shop",
	logo = "https://static.wikia.nocookie.net/gtawiki/images/f/f2/GTAV-LSCustoms-Logo.png",
	zones = {
		vec2(154.69, -3007.01),
		vec2(120.64, -3006.72),
		vec2(120.48, -3051.88),
		vec2(154.61, -3051.54)
	},
	blip = {
		coords = vec3(139.91, -3023.83, 7.04),
		color = 81,
		sprite = 446,
		disp = 6,
		scale = 0.7,
		cat = nil,
		previewImg = "https://i.imgur.com/kKC2Mw2.png",
	},
	Stash = {
		{   coords = vec4(144.38, -3051.3, 7.04, 0.0), width = 0.6, depth = 3.6,
			label = "Mech Stash", icon = "fas fa-cogs",
			slots = 50, maxWeight = 4000000,
		},
		{   coords = vec4(128.45, -3007.83, 7.04, 0.0), width = 2.4, depth = 3.5,
			label = "Mech Stash", icon = "fas fa-cogs",
			slots = 50, maxWeight = 4000000,
		},
	},
    	PersonalStash = {
	        {   prop = { model = "bkr_prop_biker_garage_locker_01", coords = vector4(124.02, -3007.25, 10.7, 182.12), },
	            label = "Personal Stash",
	            icon = "fas fa-box-open",
	            stashName = "LSTuners_Personal_",
	        },
    	},
	Shop = {
		{   	coords = vec4(128.64, -3014.68, 7.04, 0.0), width = 1.6, depth = 3.0,
            		label = "Shop", icon = "fas fa-box-open",
        	},
	},
	Crafting = {
		{	coords = vec4(136.71, -3051.29, 7.04, 0.0), width = 0.6, depth = 1.0,
			label = "Mechanic Crafting", icon = "fas fa-screwdriver-wrench",
		},
	},
	Clockin = {
		{   	prop = { model = "prop_laptop_01a", coords = vec4(145.29, -3012.93, 7.97, 266.0), },
            		label = "Clock on/off", icon = "fas fa-list",
        	},
	},
    	BossMenus = {
        	{   	coords = vec4(125.55, -3007.25, 6.94, 350.0), width = 0.4, depth = 0.4,
            		label = "Open Bossmenu", icon = "fas fa-list",
        	},
    	},
    	BossStash = {
        	{   	coords = vec4(123.98, -3007.22, 7.04, 180.0), width = 0.6, depth = 0.6, minZ = 6.24, maxZ = 8.04,
            		label = 'Open Storage', icon = "fa-solid fa-vault",
            		stashName = "LSTuners_BossStash", stashLabel = "Boss Storage",
            		slots = 100, maxWeight = 2000000,
        	},
    	},
	manualRepair = {
		{ 	prop = { model = "xm3_prop_xm3_tool_draw_01d", coords = vec4(121.0, -3047.69, 7.07, 270.11), },
			label = "Manual Repair", icon = "fas fa-cogs",
		},
	},
	nosRefill = {
		{   	prop = { model = "prop_byard_gastank02", coords = vec4(121.17, -3044.73, 7.04, 88.96), },
			label = "Refill NOS", icon = "fas fa-list",
		},
	},
	Payments = {
		{   	prop = { model = "prop_till_01", coords = vec4(146.44, -3014.09, 7.96, 15.0), },
			label = "Charge", icon = "fas fa-credit-card",
		},
	},
	carLiftModels = {
		pylons = "denis3d_carlift_02",
		lift = "denis3d_carlift_01",
		pylonOffset = vec3(-3.0, 0.0, -1.88),
		liftOffset = vec3(-3.0, 0.0, 0.18),
	},
	carLift = {
		{ coords = vec4(127.71, -3041.16, 7.06, 90.0), },
        	{ coords = vec4(127.77, -3034.91, 7.04, 90.0), },
		{ coords = vec4(128.28, -3023.01, 7.04, 90.0) },
	},
	garage = { -- requires https://github.com/jimathy/jim-jobgarage
		spawn = vec4(163.22, -3009.31, 5.27, 89.72),
		out = vec4(157.37, -3016.57, 7.04, 179.58),
		list = { "towtruck", "panto", "slamtruck", "cheburek", "utillitruck3" },
		prop = true,
	},
    	Restrictions = { -- Remove what you DON'T what the location to be able to edit
		Vehicle = { "Compacts", "Sedans", "SUVs", "Coupes", "Muscle", "Sports Classics", "Sports", "Super", "Motorcycles", "Off-road", "Industrial", "Utility", "Vans", "Cycles", "Service", "Emergency", "Commercial", "Boats", },
		Allow = { "tools", "cosmetics", "repairs", "nos", "perform", "chameleon", "paints" },
	},
	discord = {
		link = "",
		color = 2571775,
	},
}
```



</details>

When creating a new location

* its easiest to copy and paste a location file and rename it

### Location Table Entry Change

First to make sure its a separate location and not overriding things, change this line:

```lua
Locations["lstuners_gabz"] = {
```

to anything else:

```lua
Locations["newLocation"] = {
```

## Location Details

Changing these make the location unique and also are pretty required

### Enabled

```lua
Enabled = false,
```

* &#x20;This simply, enables or disables the location

### autoClock

```lua
autoClock = { enter = false, exit = false, },
```

* This handles the automatic duty clock in and out of the player when entering or exiting the job zone
* `enter`  - true or false, enables or disables clock in when entering the job zone
* `exit` - true or false, enables or disables clock OUT when exiting the job zone

### job

```lua
job = "mechanic",
```

* This is the job role that "owns" the location, only they will be able to modify vehicles here
* the default job set for all of them is `mechanic`
* If you want to change this would need to create a new job in your framworks core folders

### label

```lua
label = "Tuner Shop",
```

* Simply the "name" of the location, this will be displayed on the map as a blip

### logo

```lua
logo = "https://static.wikia.nocookie.net/gtawiki/images/f/f2/GTAV-LSCustoms-Logo.png",
```

* This isn't as important, its whats shown on discord webhook messages and in jim-payments when charging others

### zones

```lua
zones = {
	vec2(154.69, -3007.01),
	vec2(120.64, -3006.72),
	vec2(120.48, -3051.88),
	vec2(154.61, -3051.54)
},
```

* This is the physical job location box
  * it is a collection of `vec2()` 's - (x and y coords)
  * The easiest way to get these in my experience is:
    * stand in each corner of the boundary of your job location
    * Type `/vector2` and paste it in the table

### blip

```lua
blip = {
	coords = vec3(139.91, -3023.83, 7.04),
	color = 81,
	sprite = 446,
	disp = 6,
	scale = 0.7,
	cat = nil,
	previewImg = "https://i.imgur.com/kKC2Mw2.png",
},
```

* These are the vairables needs to create a blip for the location
* If you don't want a blip for the location, remove the whole blip table, not just the contents of it
* coords&#x20;
  * The coordinates of the blip to appear on the map based on world location
* color&#x20;
  * The sprite colour of the blip, these can be found [here](https://docs.fivem.net/docs/game-references/blips/#blip-colors)
* sprite
  * The sprite image that will be used for the blip, these can be found [here](https://docs.fivem.net/docs/game-references/blips/#blips)



## Specific Locations

Each location comes with many possible location settings, each with their own way to set up

#### IF YOU DON'T WANT TO USE ANY OF THESE, REMOVE EACH LOCATION TABLE, NOT THE CONTENTS OF EACH TABLE

Please take not of the formatting and style, and try to keep it like this otherwise the location won't load

These created target zones using your target script automatically, based on the variables placed here

#### There are two types of targets creatable:

### Coord Targets

```stylus
coords = vec4(144.38, -3051.3, 7.04, 0.0), width = 0.6, depth = 3.6,
```

* Coords will be the dead center of the target
* width - the "width" of the target box zone
* depth - the "depth" of the target box zone

{% hint style="info" %}
Check the formatting with this and compare to other locations, people always seem to put brackets in the wrong place
{% endhint %}

### Prop Targets

```lua
prop = { model = "prop_till_01", coords = vec4(146.44, -3014.09, 7.96, 15.0), },
```

* These are more automated and (in my opinion) easier to set up
* You need to set a model to be created, in this example I used `prop_till_01`  for a payment location
* The coords are the location the prop will spawn
* The target will automatically be created based on the models size and location

{% hint style="info" %}
Check the formatting with this and compare to other locations, people always seem to put brackets in the wrong place
{% endhint %}

Target Variables

* label - This is the "name" of the stash, this is shown when opening the stash (on supporting inventories)
* icon - This is the target script icon option retrieved from fontawesome\




### Stash

```lua
Stash = {
	{   coords = vec4(144.38, -3051.3, 7.04, 0.0), width = 0.6, depth = 3.6,
	    label = "Mech Stash", icon = "fas fa-cogs",
	    slots = 50, maxWeight = 4000000,
	},
	{   coords = vec4(128.45, -3007.83, 7.04, 0.0), width = 2.4, depth = 3.5,
	    label = "Mech Stash", icon = "fas fa-cogs",
	    slots = 50, maxWeight = 4000000,
	},
},
```

These are job locked stashes that everyone with the job role can access, intended for use with mechanic item/ingredient storage

Variables:

* slots - How many slots the inventory should have when opening
* maxWeight - The maximum storage weight of the stash

### PersonalStash

```lua
PersonalStash = {
        {   prop = { model = "bkr_prop_biker_garage_locker_01", coords = vector4(124.02, -3007.25, 10.7, 182.12), },
            label = "Personal Stash",
            icon = "fas fa-box-open",
            stashName = "LSTuners_Personal_",
        },
},
```

These are as described "Personal Stashes" for players, this is a location for players to store personal items, and also change clothes

Variables:

* stashName - Specific stashname for the database, to make personal stashes act like unique "lockers"

### Shop

```lua
Shop = {
	{   coords = vec4(128.64, -3014.68, 7.04, 0.0), width = 1.6, depth = 3.0,
            label = "Shop", icon = "fas fa-box-open",
        },
},
```

These are locations for shops for users to buy the items needed to do their job

You can easily remove or not use these locations and/or move use a different shop script to supply them

### Crafting

```lua
Crafting = {
	{   coords = vec4(136.71, -3051.29, 7.04, 0.0), width = 0.6, depth = 1.0,
	    label = "Mechanic Crafting", icon = "fas fa-screwdriver-wrench",
	},
},
```

This is the location to allow users to craft mechanic related items, this will display a menu giving options of what section to craft from

### Clockin

```lua
Clockin = {
	{   prop = { model = "prop_laptop_01a", coords = vec4(145.29, -3012.93, 7.97, 266.0), },
            label = "Clock on/off", icon = "fas fa-list",
        },
},
```

These are the toggle duty locations, these are optional as there is a config option to enable duty toggles on payment tills

### BossMenus

```lua
BossMenus = {
        {   coords = vec4(125.55, -3007.25, 6.94, 350.0), width = 0.4, depth = 0.4,
            label = "Open Bossmenu", icon = "fas fa-list",
        },
},
```

This is a location that will allow users with a boss role to access their respective bossrole

### BossStash

```lua
BossStash = {
        {   coords = vec4(123.98, -3007.22, 7.04, 180.0), width = 0.6, depth = 0.6, minZ = 6.24, maxZ = 8.04,
            label = 'Open Storage', icon = "fa-solid fa-vault",
            stashName = "LSTuners_BossStash", stashLabel = "Boss Storage",
            slots = 100, maxWeight = 2000000,
	},
},
```

### ManualRepair

```lua
manualRepair = {
	{   prop = { model = "xm3_prop_xm3_tool_draw_01d", coords = vec4(121.0, -3047.69, 7.07, 270.11), },
	    label = "Manual Repair", icon = "fas fa-cogs",
	},
},
```

Most if not all locations have this preset

The manual repair bench is a location where users can go and automatically repair their vehicles for a fee, this fee will be send to the job locations society account

These are mainly controlled in the config files

### NosRefill

```lua
nosRefill = {
	{   prop = { model = "prop_byard_gastank02", coords = vec4(121.17, -3044.73, 7.04, 88.96), },
	    label = "Refill NOS", icon = "fas fa-list",
	},
},
```

These are the empty nos can refill points, it allows users to spend cash to refill a nitrous cannister to put in their vehicle

### Payments

```lua
Payments = {
	{   prop = { model = "prop_till_01", coords = vec4(146.44, -3014.09, 7.96, 15.0), },
	    label = "Charge", icon = "fas fa-credit-card",
	},
},
```

These are the locations that job role users will be able to target to trigger `jim-payments` or other if you change the resource being triggered

### carLift

```lua
carLiftModels = {
	pylons = "denis3d_carlift_02",
	lift = "denis3d_carlift_01",
	pylonOffset = vec3(-3.0, 0.0, -1.88),
	liftOffset = vec3(-3.0, 0.0, 0.18),
},
carLift = {
	{ coords = vec4(127.71, -3041.16, 7.06, 90.0), },
        { coords = vec4(127.77, -3034.91, 7.04, 90.0), },
	{ coords = vec4(128.28, -3023.01, 7.04, 90.0) },
},
```

Car lifts have two modes:

* MLO Control
* Basic Addition

MLO Control attempts to use the car lift models from an MLO and make them usable by replacing the models with ones the script can easily control

Basic Addition essentially uses the custom provided carlift prop models to create a new carlift

### Restrictions

```lua
Restrictions = { -- Remove what you DON'T what the location to be able to edit
    Vehicle = { "Compacts", "Sedans", "SUVs", "Coupes", "Muscle", "Sports Classics", "Sports", "Super", "Motorcycles", "Off-road", "Industrial", "Utility", "Vans", "Cycles", "Service", "Emergency", "Commercial", "Boats", },
    Allow = { "tools", "cosmetics", "repairs", "nos", "perform", "chameleon", "paints" },
},
```

These are the specific restrictions for the location, what htye are ALLOWED to modify

Removing an entry from this section stops the modification of these specific vehicle or section from being usable here

### garage 

```lua
garage = { -- requires https://github.com/jimathy/jim-jobgarage	
	spawn = vec4(163.22, -3009.31, 5.27, 89.72),
	out = vec4(157.37, -3016.57, 7.04, 179.58),
	list = { "towtruck", "panto", "slamtruck", "cheburek", "utillitruck3" },
	prop = true,
},
```

This is for use with `jim-jobgarage` , allowing users to pull out temporary "job" vehicles

### discord

```lua
discord = {
	link = "",
	color = 2571775,
},
```

This is used for the preview system, if a preview is completed in this location, it will use this to send a message to discord with the informaton

link

* This is a discord webhook link, obtained by picking a channel, editing the channel and creating a new webhook

color

* This is the colour of the message, these are discord based colours
