๐งSA-BOXE
Script for PolyZone to trigger an event by pressing E.
This script offers you to make PolyZone where is possible to trigger an event by pressing E.
Configuration
Here is a simple config for boxes. The box and door setup are in different files.
Shared = {} -- DO NOT TOUCH THIS!!!
Config = {
Debug = false, -- To debug script. It shows also polyzones
VersionCheck = true, -- Here is an option to disable the print of versions in the console.
E_Side = 'left', -- left/right | This defines where will text [E] appear, if behind text or in front of.
E_Text = '[E]', -- Text which appears in front of every message.
E_Control = 38, -- Key which triggers box. All keys are registered here https://docs.fivem.net/docs/game-references/controls/#controls
}
In boxes.lua you can manage BoxEs.
--[[ TEMPLATES ]]--
--BASIC TEMPLATES
--You can combine most of things. If you find a bug contact us on Discord.
--[[
[1] = {
["enabled"] = true,
['coords'] = vector4(-57.0654, -1097.0039, 26.4224, 205.0292),
['sizeY'] = 3, -- Size of box
['sizeX'] = 2, --Size of box
--['sizeZ'] = 5, --SizeZ is optionable don't have to be there. Default is 2
['message'] = '[E] to trigger Test', --Text what you want
['side'] = 'left', --Left/Right
['Trigger'] = 'Test', --Custom name what you set up in events.lua, if you don't need just leave it blank.
},
[2] = {
["enabled"] = true,
['coords'] = vector4(-69.6077, -1088.9026, 26.5622, 40.0142),
['sizeY'] = 5, -- Size of box
['sizeX'] = 5, -- Size of box
['sizeZ'] = 5, -- Size of box
['message'] = 'to trigger Test2', --Text what you want
['side'] = 'left', --Left/Right
['Trigger'] = 'Test2', --Custom name what you set up in events.lua, if you don't need just leave it blank.
},
]]
Shared.BoxEs = {
[1] = {
["enabled"] = true,
['coords'] = vector4(-57.0654, -1097.0039, 26.4224, 205.0292),
['sizeY'] = 3, -- Size of box
['sizeX'] = 2, --Size of box
--SizeZ don't have to be there. Default is 2
['message'] = 'to trigger Test', --Text what you want
['side'] = 'left', --Left/Right
['Trigger'] = 'Test', --Custom name what you set up in events.lua, if you don't need just leave it blank.
},
}
Here you can manage the opening of the doors by BoxE. The doors still have to be set up in qb-doorlock and also radius/distance has to be set to 0, then you can use doors.lua
Anyway, BoxE is better optimized than the qb-doorlock system to control locks.
qb-doorlock - 0,00ms idle | 0,03ms use
SA-BoxE - 0,00ms idle | 0,01ms use
--[[ TEMPLATES ]]--
--BASIC TEMPLATES
--You can combine most of things. If you find a bug contact us on Discord.
--TEMPLATE FOR DOORS
--[[
[1] = {
["enabled"] = true,
['coords'] = vector4(-60.6077, -1078.9026, 26.5622, 40.0142),
['sizeY'] = 5, -- Size of box
['sizeX'] = 5, -- Size of box
--['sizeZ'] = 5, --SizeZ is optionable don't have to be there. Default is 2
['side'] = 'left', --Left/Right
['unlock'] = '[E] Unlock', --Text to unlock
--['lock'] = '[E] Lock', --Text to lock is optionable
['isDoor'] = true, --It starts qb-doorlock mode
['OneTime'] = true, --This is for one use. It automatically locks door after 2s by default or by Timer what you set below
['Timer'] = 1000, --This lock your door automatically after 1000 = 1s +-
['DoorID'] = '', --Here should be name of doors
},
[2] = {
["enabled"] = true,
['coords'] = vector4(-38.4101, -1108.5775, 26.4688, 143.6674),
['sizeY'] = 3, -- Size of box
['sizeX'] = 2, -- Size of box
['unlock'] = 'Control of gate', --Text to unlock and lock
['side'] = 'left', --Left/Right
['isDoor'] = true, --It starts qb-doorlock mode
['DoorID'] = 'PDM-Entrance', --Here should be name of doors
},
}
]]
Shared.Doors = {
--Put here code
[1] = {
["enabled"] = true,
['coords'] = vector4(-60.61, -1093.79, 26.63, 251.62),
['sizeY'] = 3, -- Size of box
['sizeX'] = 2, -- Size of box
['side'] = 'left', --Left/Right
['unlock'] = 'Unlock', --Text to unlock
['isDoor'] = true, --It starts qb-doorlock mode
['OneTime'] = false, --This is for one use. It automatically locks door after 2s by default or by Timer what you set below
['Timer'] = 1000, --This lock your door automatically after 1000 = 1s +-
['DoorID'] = 'PDM-PDM_1', --Here should be name of doors
},
Triggers are configurable in /client/events.lua
local QBCore = exports['qb-core']:GetCoreObject()
-----------------------------------------------------
-- In config set the trigger name and continue event == "NameOfTrigger"
function SummonBoxEvent(Trigger)
local event = Trigger
if event == 'Test' then
QBCore.Functions.Notify('Now it works.', 'success', 7500)
elseif event == 'Test2' then
QBCore.Functions.Notify('Now it works 2 :Wink:.', 'success', 7500)
--[[
elseif event == 'Example' then
--Whatever you want
]]
end
endven
Here you can change notify system by your preferencies
local QBCore = exports['qb-core']:GetCoreObject()
function SA_Notify(data)
local data = data
if data == 'NotAuthorized' then
QBCore.Functions.Notify(Lang:t('doors.NotAuthorized'), 'error', 7500)
end
end
Here are locales
local Translations = {
doors = {
unlock = "[E] To Unlock ",
lock = "[E] To Lock ",
NotAuthorized = 'You are not authorized to do that.',
}
}
Lang = Locale:new({
phrases = Translations,
warnOnMissing = true
})
local Translations = {
doors = {
unlock = "[E] Odemknout ",
lock = "[E] Zamknout ",
NotAuthorized = 'Na tohle jsi krรกtky.',
}
}
Lang = Locale:new({
phrases = Translations,
warnOnMissing = true
})
Features
Resmon - 0.00ms idle / 0.01ms use / 0.23 PolyZone Debug mode
Configurable - events, config
1 Active Thread / 3 are turn off and on
Easy-to-Configure!
We are using Asset Escrow system
Last updated