Pulse Studio Documentation
  • PULSE STUDIO Documentation
  • Assets & usages
    • Doorlock Systems
      • Installation
      • User guide
        • Setup
        • Create Door
        • Modify Door
        • Delete Door
        • Languages
      • Recurring problem
        • UI Not Working
        • Notify Not Working
        • Languages error
Powered by GitBook
On this page
  • Steps to fllow ensure the script works properly
  • If you are using standalone mode, you will need to adapt the script
  1. Assets & usages
  2. Doorlock Systems
  3. User guide

Setup

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.

Steps to fllow ensure the script works properly

1

Go to Shared/config.lua

In this file you will find parameters to set as follows

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

You can also change the language in language = ‘en’ to another language in the locales/ file.

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.

2

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.

If you don't want any job to have access to all the doors, you must put nothing in inverted commas.

3

Finalisation

Now you have configured the script

Learn in account if you put standalone

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

1

Go to shared/config.lua

Please make the line where you are asked to select the framework standalone

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

-----------------
--- 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.

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.

2

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

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

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

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

PreviousUser guideNextCreate Door

Last updated 2 months ago