> For the complete documentation index, see [llms.txt](https://pulse-studio.gitbook.io/pulse-studio-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pulse-studio.gitbook.io/pulse-studio-documentation/assets-and-usages/doorlock-systems/user-guide/setup.md).

# Setup

{% hint style="warning" %}
Checking the framework of a script on FiveM is essential to ensure its compatibility with the server environment and to avoid execution errors. This allows the code to be adapted to the correct methods for the framework used, guaranteeing stability and optimising performance. In addition, this check facilitates the integration and maintenance of the script while reducing the risk of conflicts between resources.
{% endhint %}

## Steps to fllow ensure the script works properly

{% stepper %}
{% step %}

### Go to Shared/config.lua

In this file you will find parameters to set as follows

```lua
Config = {
	language = 'en',
	framework  = "auto-detect", -- Standalone | ESX | QBCORE | auto-detect
	jobsAccessAllDoor = "police",
	listAccessCommandDoorAdmin = {
		"admin",
		"mod",
		"helper",
		"user"
	}
}

-----------------
--- Modify for framework or your system Notify
-----------------
Notify = function(message)
	if Config.framework == "ESX" then
		Framework.ShowNotification(message)
	elseif Config.framework == "QBCORE" then
		Framework.Functions.Notify(message)
	elseif Config.framework == "Standalone" then
		--Use your custom notify
	end
end
```

{% hint style="info" %}
You can also change the language in language = ‘en’ to another language in the locales/ file.
{% endhint %}

{% hint style="info" %}
If you encounter any errors, please enter your framework, you can choose 3 ( ESX, QBCORE, Standalone ), you must enter your framework in inverted commas for this to work correctly.
{% endhint %}

{% endstep %}

{% step %}

### Modify the job with access to all doors

As shown above, you have a jobsAccessAllDoor, which corresponds to the job that has access to all the doors. The default example is set to the font job, which can be modified in the quotes, so you can replace it depending on the job you want.

{% hint style="info" %}
If you don't want any job to have access to all the doors, you must put nothing in inverted commas.
{% endhint %}

{% endstep %}

{% step %}

### Finalisation

Now you have configured the script
{% endstep %}
{% endstepper %}

{% hint style="danger" %}
Learn in account if you put standalone
{% endhint %}

## If you are using standalone mode, you will need to adapt the script

{% stepper %}
{% step %}

### Go to shared/config.lua

{% hint style="danger" %}
Please make the line where you are asked to select the framework standalone
{% endhint %}

Then you have a piece of code for the notifications, as shown below:

```lua
-----------------
--- Modify for framework or your system Notify
-----------------
Notify = function(message)
	if Config.framework == "ESX" then
		Framework.ShowNotification(message)
	elseif Config.framework == "QBCORE" then
		Framework.Functions.Notify(message)
	elseif Config.framework == "Standalone" then
		--Use your custom notify
	end
end
```

Where you'll find ‘Use your custom notify’, you'll need to set your notification system to warn you of the actions you've just taken.

{% hint style="warning" %}
It's just a notification that it's being used on the client side and not the server side, so you don't need to use TriggerServerEvent or server-side triggers.
{% endhint %}

{% endstep %}

{% step %}

### Now go to server/framework/Standalone.lua

You should adapt the content of the functions to ensure correct operation

On the right-hand side, you have a function called GetIdPlayer\_STANDALONE, which retrieves the player id, which is mandatory for it to work.

First of all, you have a function called `GetIdPlayer_STANDALONE`, which is responsible for retrieving player data, a mandatory step for its proper functioning. Based on the player's ID, you should receive a response containing their data, such as their job, rank, etc.

**Example**

```lua
function GetIdPlayer_STANDALONE(idPlayer)
	return --Data Player
end
```

Next, you have another function called `HasJob_STANDALONE`, which allows you to check if the player has the correct job and rank. You need to adapt its content so that it returns whether the player has the job or not, using `return true` or `return false` to indicate the result. Additionally, you should implement a condition so that if the player has a specific job, such as "police," the function directly returns `true` when used.

**Example**

```lua
function HasJob_STANDALONE(jobname, grade, player)
	--if grade == nil then
	--	if jobname == player.job.name then
	--		return true
	--	else
	--		return false
	--	end
	--end
	--if jobname == player.job.name and player.job.grade >= grade then
	--	return true
	--else
	--	return false
	--end
end
```

Next, you have another function called GetHasGroupPlayer, which lets you check whether the player has the right group (e.g. ‘admin’). You need to adapt its content so that it indicates whether or not the player has a group, using return true or return false to indicate the result.

**Example**

```lua
function GetHasGroupPlayer(dataPlayer, group)
	--if dataPlayer.group == group then
	--	return true
	--else
	--	return false
	--end
end
```

{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://pulse-studio.gitbook.io/pulse-studio-documentation/assets-and-usages/doorlock-systems/user-guide/setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
