Brutal Scripts
YouTubeDiscordStore
  • 🙉About Us
  • ↗️Translate
  • Informations
    • 🔒Escrow System
    • 🔥Common Problems
  • Scripts
    • 📄Notify
      • Accessible files
      • Installation guide
    • 🔠Text-UI
      • Installation guide
      • Exports & How to use
      • Integrations
    • 🤟Gangs
      • Accessible files
      • Installation guide
      • exports / triggers
      • Create a new gang
    • 🏡Housing
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🔑Keys
      • Accessible files
      • Installation guide
      • exports / triggers
    • 💥Gang Actions
      • Accessible files
      • Installation guide
      • exports / triggers
      • Controlling the menu
    • ⭕Radial
      • Accessible files
      • Installation guide
      • Adding new buttons
    • 🎯Executions
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🐶Pets + K9 V2
      • Accessible files
      • Installation guide
    • 👮Police Job
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🚑Ambulance Job
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🔧Mechanic Job
      • Accessible files
      • Installation guide
      • exports / triggers
    • 💪GYM with Skills V2
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🔫Paintball
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🥊Boxing
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🔨Crafting
      • Accessible files
      • Installation guide
      • Creating a new crafting table
    • 🏦Banking
      • Accessible files
      • Installation guide
      • Paycheck transactions
      • Registering transactions
    • 🎳Bowling
      • Accessible files
      • Installation guide
      • exports / triggers
    • 🦌Hunting
      • Accessible files
      • Installation guide
    • 🏁Racing Script
      • Accessible files
      • Installation guide
    • 🐛Reports
      • Accessible files
      • Installation guide
    • 🛒Shop Robbery
      • Accessible files
      • Installation guide
    • 🛥️Yacht Heist
      • Accessible files
      • Installation guide
    • 🧾Billing
      • Accessible files
      • Installation guide
      • Triggers
    • 💰Truck Robbery
      • Accessible files
      • Installation guide
    • 🏧Atm Robbery
      • Accessible files
      • Installation guide
    • 👶Baby script
      • Installation guide
      • How to add more babys
  • Others
    • Register Key Mapping
    • Drill Minigame
    • Discord Webhook
Powered by GitBook
On this page

Was this helpful?

  1. Scripts
  2. Keys

Accessible files

Here you can find all the files which can be edite to make the asset compatible with your server.​

config.lua
Config = {
    Core = 'ESX',  -- 'ESX' / 'QBCORE' | Other core setting on the 'core' folder.
    TextUI = 'brutal_textui', -- false / 'brutal_textui' / 'ox_lib' / 'okokTextUI' / 'ESXTextUI' / 'QBDrawText' // Custom can be add in the cl_utils.lua!!!
    BrutalNotify = true, -- Buy here: (4€+VAT) https://store.brutalscripts.com | Or set up your own notify >> cl_utils.lua
    AdminGroups = {'superadmin', 'admin', 'mod', 'god'}, -- Admin groups

    DataStorage = {
        --[[
        optimized = Saves the data when the script is restarted, the server is shut down or restarted, or during a scheduled server restart.
            events: "txAdmin:events:serverShuttingDown" & "txAdmin:events:scheduledRestart" or fixed restart times.
        resource_heavy = all data will be saved immediately, this is very stressful for the server so we don't recommend using this, but the choice is up to you.
        ]]--

        Type = "optimized", -- "optimized" / "resource_heavy"
        Restarts = {}, -- example: "11:59" | Save the data 1 minute before restart. Save data at 15:59 instead of 16:00
    },

    CopyPrice = 500, -- Key copy price
    DriveWithKey = true, -- If true, players can only drive the car if they have a key, IF false, they can drive the car anytime they find it unlocked.
    LockPicking = {maxTry = 1, item = "lockpick"}, -- maxTry = maximum try per vehicle | item = item or ""
    Hotwiring = {maxTry = 1, successrate = 25, item = "screwdriver"}, -- maxTry = maximum try per vehicle | successrate = 10 = 10% | item = item or ""
    AlertPolice = {use = true, chance = 10}, -- chance 10 = 10% | Supports Brutal Policejob basically to modity it open the cl_utils.lua file
    LostVehicleKeys = {
        npc = vector4(-354.5593, -128.0446, 39.4307, 65.9746), -- npc VECTOR4! coords
        model = "ig_benny", -- npc type
        blip = {use = true, label = "Lost Vehicle Keys", size = 1.0, sprite = 186, color = 1},
        price = 2500 -- if they lost all of their keys then the price is higher
    },
    
    QuickKeys = {
        ['everyone'] = {  -- no one needs a key to drive those vehicles
            "adder", "bmx"
        },

        ['police'] = { -- player in the job do not need a key to drive the vehicle
            "police", "police2", "police3", "policeb", "pbus"
        },

        ['ambulance'] = { -- player in the job do not need a key to drive the vehicle
            "ambulance",
        },
    },

    Commands = {
        MyKeys = {
            Command = 'mykeys', 
            Suggestion = 'To manage your keys',
            Control = '',  -- Controls list:  https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/
        },

        VehicleKey = {
            Command = 'vkey', 
            Suggestion = 'To open the nearest vehicle',
            Control = '', -- 'G' | Controls list:  https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/keyboard/
        },

        Lockpicking = {
            Command = 'lockpick', 
            Suggestion = 'Lockpicking the nearest vehicle',
        },

        Hotwiring = {
            Command = 'hotwiring', 
            Suggestion = 'To start the vehicle without keys',
        },

        -- Admin --

        StaffMode = {
            Command = 'kstaff', 
            Suggestion = 'To switch Key System Staff mode ON/OFF',
        },

        AddKey = {  -- /addkey [ID] [KEY-ID] [label]
            Command = 'addkey', 
            Suggestion = 'To add key',
        },

        RemoveKey = { -- /removekey [ID] [KEY-ID]
            Command = 'removekey', 
            Suggestion = 'To remove key',
        },

        AddVehicleKey = { -- /addvehiclekey [ID] [PLATE]
            Command = 'addvehiclekey', 
            Suggestion = 'To add vehicle key',
        },

        AddVehicleTemporaryKey = { -- /addtempkey [ID] [PLATE]
            Command = 'addtempkey', 
            Suggestion = 'To add vehicle temporary key',
        },

        RemoveVehicleKey = { -- /removevehiclekey [ID] [PLATE]
            Command = 'removevehiclekey', 
            Suggestion = 'To remove vehicle key',
        },
    },

    -----------------------------------------------------------
    -----------------------| TRANSLATE |-----------------------
    -----------------------------------------------------------

    NUILanguage = "en", -- "en", "es", "fr", "de", "pt", "it", "pl", "nl", "ru", "tr", "hu", "ro", "cs", "sv", "ar"

    MoneyForm = '$', -- Money form

    Texts = {
        [1] = {'[E] - Lost Key', 38, 'Open the lost key menu'},
    },
    
    -- Notify function EDITABLE >> cl_utils.lua
    Notify = { 
        [1] = {"Keys", "Staff mode: ON", 5000, "success"},
        [2] = {"Keys", "Staff mode: OFF", 5000, "error"},
        [3] = {"Keys", "You got a new key!", 5000, "info"},
        [4] = {"Keys", "A key has been deleted!", 5000, "success"},
        [5] = {"Keys", "You gave them a key:", 5000, "info"},
        [6] = {"Keys", "You copied a key!", 5000, "success"},
        [7] = {"Keys", "You got a key from:", 5000, "info"},
        [8] = {"Keys", "Successful lock change!", 5000, "success"},
        [9] = {"Keys", "Only the vehicle owner can change!", 5000, "error"},
        [10] = {"Keys", "You don't have enough money!", 5000, "error"},
        [11] = {"Keys", "You have no car / you have keys to all your cars!", 5000, "error"},
        [12] = {"Keys", "No vehicle near you!", 5000, "error"},
        [13] = {"Keys", "The vehicle is open!", 5000, "error"},
        [14] = {"Keys", "Someone is sitting in the car!", 5000, "error"},
        [15] = {"Keys", "You have reached the maximum amount of keys!", 5000, "error"},
        [16] = {"Keys", "This person already has a temporary key for this car!", 5000, "error"},
        [17] = {"Keys", "To reduce the server load, you will have to wait a little!", 5000, "error"},
        [18] = {"Keys", "Plate: 3-8 characters", 5000, "error"},
        [19] = {"Keys", "Invalid Player ID!", 5000, "error"},
        [20] = {"Keys", "You can't try again!", 5000, "error"},
        [21] = {"Keys", "You have to sit in the driver's seat!", 5000, "error"},
        [22] = {"Keys", "You did it! You've started the engine!", 5000, "success"},
        [23] = {"Keys", "Unfortunately the safety lock would not let you start the engine!", 5000, "error"},
        [24] = {"Keys", "You need: Lockpick", 5000, "error"},
        [25] = {"Keys", "You need: Screwdriver", 5000, "error"},
    },
}
client-utils.lua
ESX = Core
QBCore = Core

-- Buy here: (4€+VAT) https://store.brutalscripts.com
function notification(title, text, time, type)
    if Config.BrutalNotify then
        exports['brutal_notify']:SendAlert(title, text, time, type)
    else
        -- Put here your own notify and set the Config.BrutalNotify to false
        SetNotificationTextEntry("STRING")
        AddTextComponentString(text)
        DrawNotification(0,1)

        -- Default ESX Notify:
        --TriggerEvent('esx:showNotification', text)

        -- Default QB Notify:
        --TriggerEvent('QBCore:Notify', text, 'info', 5000)

        -- OKOK Notify:
        -- exports['okokNotify']:Alert(title, text, time, type, false)

    end
end

function TextUIFunction(type, text)
    if type == 'open' then
        if Config.TextUI:lower() == 'ox_lib' then
            lib.showTextUI(text)
        elseif Config.TextUI:lower() == 'okoktextui' then
            exports['okokTextUI']:Open(text, 'darkblue', 'right')
        elseif Config.TextUI:lower() == 'esxtextui' then
            ESX.TextUI(text)
        elseif Config.TextUI:lower() == 'qbdrawtext' then
            exports['qb-core']:DrawText(text,'left')
        elseif Config.TextUI:lower() == 'brutal_textui' then
            exports['brutal_textui']:Open(text, "blue")
        end
    elseif type == 'hide' then
        if Config.TextUI:lower() == 'ox_lib' then
            lib.hideTextUI()
        elseif Config.TextUI:lower() == 'okoktextui' then
            exports['okokTextUI']:Close()
        elseif Config.TextUI:lower() == 'esxtextui' then
            ESX.HideUI()
        elseif Config.TextUI:lower() == 'qbdrawtext' then
            exports['qb-core']:HideText()
        elseif Config.TextUI:lower() == 'brutal_textui' then
            exports['brutal_textui']:Close()
        end
    end
end

function PoliceAlert(coords, plate)
    local x,y,z = table.unpack(coords)
    local streetLabel = GetStreetNameFromHashKey(GetStreetNameAtCoord(x,y,z)) 

    if GetResourceState("brutal_policejob") == "started" then
        TriggerServerEvent('brutal_policejob:server:citizencall', 'create', "Vehicle jacking", coords, streetLabel)
    end
end

function OpenMenuUtil()
    InMenu = true
    SetNuiFocus(true, true)

    Citizen.CreateThread(function()
        while InMenu do
            N_0xf4f2c0d4ee209e20() -- it's disable the AFK camera zoom
            Citizen.Wait(15000)
        end 
    end)

    DisplayRadar(false)
end

function DisableMinimap()
    DisplayRadar(false)
    -- Here you can add a trigger to hide your HUD system
end

function EnableMinimap()
    DisplayRadar(true)
    -- Here you can add a trigger to enable your HUD system
end
server-utils.lua
function StaffCheck(source)
    local staff = false

    if Config.Core:upper() == 'ESX'then
        local player = Core.GetPlayerFromId(source)
        local playerGroup = player.getGroup()

        for i, Group in ipairs(Config.AdminGroups) do
            if playerGroup == Group then
                staff = true
                break
            end
        end
    elseif Config.Core:upper() == 'QBCORE' then

        for i, Group in ipairs(Config.AdminGroups) do
            if Core.Functions.HasPermission(source, Group) or IsPlayerAceAllowed(source, Group) or IsPlayerAceAllowed(source, 'command') then
                staff = true
                break
            end
        end
    end

    return staff
end
client-core.lua
Core = nil

if Config['Core']:upper() == 'ESX' then
    local _esx_ = 'new' -- 'new' / 'old'

    if _esx_ then
        Core = exports['es_extended']:getSharedObject()
    else
        while Core == nil do
            TriggerEvent('esx:getSharedObject', function(obj) Core = obj end)
            Citizen.Wait(0)
        end
    end

    LoadedEvent = 'esx:playerLoaded'
    ReviveEvent = 'esx_ambulancejob:revive'
    JobUpdateEvent = 'esx:setJob'
    TSCB = Core.TriggerServerCallback

    function GetPlayerJobDatas()
        return Core.GetPlayerData().job
    end

    function GetPlayersFunction()
        return Core.Game.GetPlayers()
    end

    function GetVehiclePropertiesFunction(vehicle)
        return Core.Game.GetVehicleProperties(vehicle)
    end

    function SetVehiclePropertiesFunction(vehicle, properties)
        return Core.Game.SetVehicleProperties(vehicle, properties)
    end

    function GetClosestVehicleFunction(coords, modelFilter)
        return Core.Game.GetClosestVehicle(coords, modelFilter)
    end

elseif Config['Core']:upper() == 'QBCORE' then
    Core = exports['qb-core']:GetCoreObject()

    LoadedEvent = 'QBCore:Client:OnPlayerLoaded'
    ReviveEvent = 'hospital:client:Revive'
    JobUpdateEvent = 'QBCore:Client:OnJobUpdate'
    TSCB = Core.Functions.TriggerCallback

    function GetPlayerJobDatas()
        return Core.Functions.GetPlayerData().job
    end

    function GetPlayersFunction()
        return Core.Functions.GetPlayers()
    end

    function GetVehiclePropertiesFunction(vehicle)
        return Core.Functions.GetVehicleProperties(vehicle)
    end

    function SetVehiclePropertiesFunction(vehicle, properties)
        return Core.Functions.SetVehicleProperties(vehicle, properties)
    end

    function GetClosestVehicleFunction(coords, modelFilter)
        return Core.Functions.GetClosestVehicle(coords, modelFilter)
    end
    
end
server-core.lua
Core = nil

if Config['Core']:upper() == 'ESX' then
    local _esx_ = 'new' -- 'new' / 'old'
    
    if _esx_ == 'new' then
        Core = exports['es_extended']:getSharedObject()
    else
        Core = nil
        TriggerEvent('esx:getSharedObject', function(obj) Core = obj end)
        while Core == nil do
            Citizen.Wait(0)
        end
    end

    RESCB = Core.RegisterServerCallback
    GETPFI = Core.GetPlayerFromId
    RUI = Core.RegisterUsableItem
    SetJobEvent = 'esx:setJob'
    onPlayerDeath = 'esx:onPlayerDeath'
    SQLData = {
        player_vehicles = 'owned_vehicles',
    }

    function GetIdentifier(source)
        local xPlayer = GETPFI(source)
        while xPlayer == nil do
            Citizen.Wait(1000)
            xPlayer = GETPFI(source) 
        end
        return xPlayer.identifier
    end

    function GetPlayerByIdentifier(identifier)
        return Core.GetPlayerFromIdentifier(identifier)
    end

    function GetAccountMoney(source,account)
        local xPlayer = GETPFI(source)
        if account == 'bank' then
            return xPlayer.getAccount(account).money
        elseif account == 'money' then
            return xPlayer.getMoney()
        end
    end

    function AddMoneyFunction(source, account, amount)
        local xPlayer = GETPFI(source)
        if account == 'bank' then
            xPlayer.addAccountMoney('bank', amount)
        elseif account == 'money' then
            xPlayer.addMoney(amount)
        end
    end

    function RemoveAccountMoney(source, account, amount)
        local xPlayer = GETPFI(source)
        if account == 'bank' then
            xPlayer.removeAccountMoney('bank', amount)
        elseif account == 'money' then
            xPlayer.removeMoney(amount)
        end
    end

    function GetItemCount(source, item)
        local xPlayer = GETPFI(source)

        if _esx_ == 'new' then
            return xPlayer.getInventoryItem(item).count
        else
            if string.sub(item, 0, 6):lower() == 'weapon' then
                local loadoutNum, weapon = xPlayer.getWeapon(item:upper())

                if weapon then
                    return true
                else
                    return false
                end
            else
                return xPlayer.getInventoryItem(item).count
            end
        end
    end
    
    function RemoveItem(source, item, amount)
        local xPlayer = GETPFI(source)
        if _esx_ == 'new' then
            xPlayer.removeInventoryItem(item, amount)
        else
            if string.sub(item, 0, 6):lower() == 'weapon' then
                xPlayer.removeWeapon(item)
            else
                xPlayer.removeInventoryItem(item, amount)
            end
        end
    end

    function AddItem(source, item, count, info)
        local xPlayer = GETPFI(source)
        if _esx_ == 'new' then
            xPlayer.addInventoryItem(item, count, info)
        else
            if string.sub(item, 0, 6):lower() == 'weapon' then
                xPlayer.addWeapon(item, 90)
            else
                xPlayer.addInventoryItem(item, count)
            end
        end
    end

    function GetPlayerNameFunction(source)
        local name
        if Config.SteamName then
            name = GetPlayerName(source) or 'No Data'
        else
            local xPlayer = GETPFI(source)
            name = xPlayer.getName() or 'No Data'
        end
        return name
    end

    function GetPlayerJob(source)
        local xPlayer = GETPFI(source)
        return xPlayer.job.name
    end

    function CreateCoreJob(name, label, grades)
        Core.CreateJob(name, label, grades)
    end

    function SetCoreJob(source, job, grade)
        local xPlayer = GETPFI(source)
        xPlayer.setJob(job, grade)
    end

    function SetCoreJobOffline(identifier, job, grade)
        MySQL.update('UPDATE users SET job = ?, job_grade = ? WHERE identifier = ?', {job, grade, identifier})
    end

    function GetPlayersFunction()
        return Core.GetPlayers()
    end

elseif Config['Core']:upper() == 'QBCORE' then

    Core = exports['qb-core']:GetCoreObject()
    
    RESCB = Core.Functions.CreateCallback
    GETPFI = Core.Functions.GetPlayer
    RUI = Core.Functions.CreateUseableItem
    SetJobEvent = 'QBCore:Server:SetGang'
    onPlayerDeath = GetResourceState("brutal_ambulancejob") == "started" and 'onPlayerDeath' or 'hospital:server:SetDeathStatus'
    SQLData = {
        player_vehicles = 'player_vehicles',
    }

    function GetIdentifier(source)
        local xPlayer = GETPFI(source)
        while xPlayer == nil do
            Citizen.Wait(1000)
            xPlayer = GETPFI(source) 
        end
        return xPlayer.PlayerData.citizenid
    end

    function GetPlayerByIdentifier(identifier)
        return Core.Functions.GetPlayerByCitizenId(identifier)
    end

    function GetAccountMoney(source, account)
        local xPlayer = GETPFI(source)
        if account == 'bank' then
            return xPlayer.PlayerData.money.bank
        elseif account == 'money' then
            return xPlayer.PlayerData.money.cash
        end
    end

    function AddMoneyFunction(source, account, amount)
        local xPlayer = GETPFI(source)
        if account == 'bank' then
            xPlayer.Functions.AddMoney('bank', amount)
        elseif account == 'money' then
            xPlayer.Functions.AddMoney('cash', amount)
        end
    end

    function RemoveAccountMoney(source, account, amount)
        local xPlayer = GETPFI(source)
        if account == 'bank' then
            xPlayer.Functions.RemoveMoney('bank', amount)
        elseif account == 'money' then
            xPlayer.Functions.RemoveMoney('cash', amount)
        end
    end

    function GetItemCount(source, item)
        local xPlayer = GETPFI(source)
        local items = xPlayer.Functions.GetItemByName(item)
        local item_count = 0
        if items ~= nil then
            item_count = items.amount
        else
            item_count = 0
        end
        return item_count
    end

    function RemoveItem(source, item, amount)
        local xPlayer = GETPFI(source)
        xPlayer.Functions.RemoveItem(item, amount)
    end

    function AddItem(source, item, count, info)
        local xPlayer = GETPFI(source)
        xPlayer.Functions.AddItem(item, count, nil, info)
    end

    function GetPlayerNameFunction(source)
        local name
        if Config.SteamName then
            name = GetPlayerName(source)
        else
            local xPlayer = GETPFI(source)
            name = xPlayer.PlayerData.charinfo.firstname..' '..xPlayer.PlayerData.charinfo.lastname
        end
        return name
    end

    function GetPlayerJob(source)
        local xPlayer = GETPFI(source)
        return xPlayer.PlayerData.gang.name
    end

    function CreateCoreJob(name, label, grades)
        Core.Functions.AddGang(name, 
        {
            label = label,
            grades = grades,
        })
    end

    function UpdateCoreJob(name, label, grades)
        Core.Functions.UpdateGang(name, {
            label = label,
            grades = grades,
        })
    end

    function RemoveCoreJob(name)
        Core.Functions.RemoveGang(name)
    end

    function SetCoreJob(source, job, grade)
        local xPlayer = GETPFI(source)
        xPlayer.Functions.SetGang(job, grade)
    end

    function SetCoreJobOffline(identifier, job)
        local joblabel = "None"
        if Gangs[job] ~= nil and Gangs[job].label ~= nil then
            joblabel = Gangs[job].label
        end

        MySQL.update('UPDATE players SET gang = ? WHERE citizenid = ?', {json.encode({grade = {level = 0, name = "Member"}, name = job, isboss = false, label = joblabel}), identifier})
    end

    function GetPlayersFunction()
        return Core.Functions.GetPlayers()
    end
end
PreviousKeysNextInstallation guide

Last updated 7 days ago

Was this helpful?

🔑
Page cover image