Studio PLAYERS
  • Studio PLAYERS
  • ๐Ÿ“ฆQB/QBX SCRIPTS
    • ๐Ÿ’ธSA-MONEY
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
        • โš™๏ธInstallation
        • โš™๏ธMigration
        • โš™๏ธAdd new currency
      • ๐Ÿ—ƒ๏ธDisplays $ in inventory
      • ๐Ÿ“šHUD Implementations
        • ๐Ÿ“—17mov_Hud
        • ๐Ÿ“—wais-hudv5
    • ๐Ÿ’ฐSA-MONEYWASH
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
    • ๐Ÿ•SA-PLAYTIME
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
      • โœˆ๏ธExports
    • โ˜ ๏ธSA-CHARACTERKILL
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
    • ๐ŸงŠSA-BOXE
      • ๐Ÿ’กIntroduction
      • ๐Ÿ’กUsage
      • โš™๏ธInstallation
    • ๐ŸšฆSA-TRAFFICLIGHTSPRIORITY
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
  • ๐Ÿ“ฆESX SCRIPTS
    • ๐Ÿ•SA-PLAYTIME
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
      • โœˆ๏ธExports
    • โ˜ ๏ธSA-CHARACTERKILL
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
    • ๐ŸšฆSA-TRAFFICLIGHTSPRIORITY
      • ๐Ÿ’กIntroduction
      • โš™๏ธInstallation
  • ๐Ÿ› ๏ธFAQ
    • ๐Ÿ› ๏ธGeneral Issues
    • ๐Ÿ› ๏ธSA-Money-V2
Powered by GitBook
On this page
  1. QB/QBX SCRIPTS

SA-BOXE

Script for PolyZone to trigger an event by pressing E.

Last updated 1 year ago

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.

In boxes.lua you can manage BoxEs.

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

Triggers are configurable in /client/events.lua

Here you can change notify system by your preferencies

Here are locales

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

๐Ÿ“ฆ
๐ŸงŠ
Preview
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-BoxE/previews/config.lua
Shared = {} -- DO NOT TOUCH THIS!!!



Config = {



    Framework = 'qb-core',  -- Don't touch this. Change it only if you have renamed qb

    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 define where will text [E] appear, if behind text or in front of.

    E_Text = '[E]',     -- Text which appear in fron of every message.

    E_Control = 38,     -- Key which trigger box. All keys are registere here https://docs.fivem.net/docs/game-references/controls/#controls



}

https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-BoxE/previews/boxes.lua
--[[        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.

    },

}
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-BoxE/previews/doors.lua
--[[        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

    },

}
Page cover image
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-BoxE/previews/events.lua
local QBCore = exports[Config.Framework]: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

end
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-BoxE/previews/functions.lua
local QBCore = exports[Config.Framework]:GetCoreObject()



function SA_Notify(data)

    local data = data

    if data == 'NotAuthorized' then

        QBCore.Functions.Notify(Lang:t('doors.NotAuthorized'), 'error', 7500)

    end

end
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-BoxE/previews/en.lua
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

})
https://github.com/Studio-PLAYERS/TEBEX-Doc/blob/main/SA-BoxE/previews/cs.lua
local Translations = {

    doors = {

        unlock = "[E] Odemknout ",

        lock = "[E] Zamknout ",

        NotAuthorized = 'Na tohle jsi krรƒยกtky.',

    }

}



Lang = Locale:new({

    phrases = Translations,

    warnOnMissing = true

})