Shared | QBCore Documentation (2024)

  • The shared file inside qb-core contains all the information for your jobs, vehicles, items & more! You will spend a lot of time in this file configuring everything to your exact specifications. Jenkins hashes are used frequently, you can find more information on those here

  • QBCore uses lua tables to store static information instead of a database to prevent needing to execute queries. When you combine this with the ability to use Shared Exports it can be a very powerful tool!

    QBShared = QBShared or {}local StringCharset = {}local NumberCharset = {}for i = 48, 57 do NumberCharset[#NumberCharset+1] = string.char(i) endfor i = 65, 90 do StringCharset[#StringCharset+1] = string.char(i) endfor i = 97, 122 do StringCharset[#StringCharset+1] = string.char(i) endfunction QBShared.RandomStr(length) if length <= 0 then return '' end return QBShared.RandomStr(length - 1) .. StringCharset[math.random(1, #StringCharset)]endfunction QBShared.RandomInt(length) if length <= 0 then return '' end return QBShared.RandomInt(length - 1) .. NumberCharset[math.random(1, #NumberCharset)]endfunction QBShared.SplitStr(str, delimiter) local result = {} local from = 1 local delim_from, delim_to = string.find(str, delimiter, from) while delim_from doresult[#result+1] = string.sub(str, from, delim_from - 1) from = delim_to + 1 delim_from, delim_to = string.find(str, delimiter, from) endresult[#result+1] = string.sub(str, from) return resultendfunction QBShared.Trim(value)if not value then return nil end return (string.gsub(value, '^%s*(.-)%s*$', '%1'))endfunction QBShared.Round(value, numDecimalPlaces) if not numDecimalPlaces then return math.floor(value + 0.5) end local power = 10 ^ numDecimalPlaces return math.floor((value * power) + 0.5) / (power)endfunction QBShared.ChangeVehicleExtra(vehicle, extra, enable)if DoesExtraExist(vehicle, extra) thenif enable thenSetVehicleExtra(vehicle, extra, false)if not IsVehicleExtraTurnedOn(vehicle, extra) thenQBShared.ChangeVehicleExtra(vehicle, extra, enable)endelseSetVehicleExtra(vehicle, extra, true)if IsVehicleExtraTurnedOn(vehicle, extra) thenQBShared.ChangeVehicleExtra(vehicle, extra, enable)endendendendfunction QBShared.SetDefaultVehicleExtras(vehicle, config) -- Clear Extras for i = 1,20 do if DoesExtraExist(vehicle, i) then SetVehicleExtra(vehicle, i, 1) end end for id, enabled in pairs(config) do QBShared.ChangeVehicleExtra(vehicle, tonumber(id), type(enabled) == 'boolean' and enabled or true) endendQBShared.StarterItems = { ['phone'] = { amount = 1, item = 'phone' }, ['id_card'] = { amount = 1, item = 'id_card' }, ['driver_license'] = { amount = 1, item = 'driver_license' },}
  • Found in qb-core/shared/items.lua

  • QBShared.Items = { ['id_card'] = { ['name'] = 'id_card', -- Actual item name for spawning/giving/removing ['label'] = 'ID Card', -- Label of item that is shown in inventory slot ['weight'] = 0, -- How much the items weighs ['type'] = 'item', -- What type the item is (ex: item, weapon) ['image'] = 'id_card.png', -- This item image that is found in qb-inventory/html/images (must be same name as ['name'] from above) ['unique'] = true, -- Is the item unique (true|false) - Cannot be stacked & accepts item info to be assigned ['useable'] = true, -- Is the item useable (true|false) - Must still be registered as useable ['shouldClose'] = false, -- Should the item close the inventory on use (true|false) ['combinable'] = nil, -- Is the item able to be combined with another? (nil|table) ['description'] = 'A card containing all your information to identify yourself' -- Description of time in inventory }}-- Example of an item that is combinable and not nil['combinable'] = { accept = {'snspistol_part_1'}, -- The other item that can be it can be combined with reward = 'snspistol_stage_1', -- The item that is rewarded upon successful combine anim = { -- Set the animation, progressbar text and length of time it takes to combine ['dict'] = 'anim@amb@business@weed@weed_inspecting_high_dry@', -- The animation dictionary ['lib'] = 'weed_inspecting_high_base_inspector', -- The animation library ['text'] = 'Atttaching attachments', -- Text that will be displayed in the progress bar ['timeOut'] = 15000,} -- How long the animation should take to complete }}
    QBShared.ForceJobDefaultDutyAtLogin = true -- true: Force duty state to jobdefaultDuty | false: set duty state from database last savedQBShared.Jobs = { ['unemployed'] = { -- job name (string) label = 'Civilian', -- job label (string) defaultDuty = true, -- enable/disable player being auto clocked-in (bool) grades = { ['0'] = { -- job grade (string) name = 'Freelancer', -- job grade name (string) payment = 10 -- paycheck amount (number) }, }, }, ['police'] = { label = 'Law Enforcement', defaultDuty = true, grades = { ['0'] = { name = 'Recruit', payment = 50 }, ['1'] = { name = 'Officer', payment = 75 }, ['2'] = { name = 'Sergeant', payment = 100 }, ['3'] = { name = 'Lieutenant', payment = 125 }, ['4'] = { name = 'Chief', isboss = true, -- set this grade as a boss to access boss menu payment = 150 }, }, },}
  • Found in qb-core/shared/vehicles.lua

  • QBShared.Vehicles = { ['adder'] = { -- Vehicle model/spawn name (string) ['name'] = 'Adder', -- Desired name/label for the vehicle (string) ['brand'] = 'Truffade', -- The brand of vehicle (string) ['model'] = 'adder', -- Vehicle model/spawn name (string) ['price'] = 280000, -- How much the vehicle costs at the dealership (number) ['category'] = 'super', -- The category the vehicle will display in at the dealership (string) ['hash'] = `adder`, -- Vehicle hash key (jenkins hash || GetHashKey(model)) ['shop'] = 'pdm', -- The desired shop the vehicle is available for sale at (string) }}
  • Found in qb-core/shared/gangs.lua

  • QBShared.Gangs = { ['mynewgang'] = { -- grade name (string) label = 'My Fancy Gang Name', -- Label of the gang (string) grades = { ['0'] = { -- grade (number) name = 'I am grade 0' }, ['1'] = { name = 'I am grade 1' -- Label of the gang grade (string) }, ['2'] = { name = 'I am grade 2' }, ['3'] = { name = 'I am grade 3', isboss = true -- set this grade as a boss to access gang menu }, }, }}
  • Found in qb-core/shared/weapons.lua

  • Weapons are added in shared/items.lua as well!

    QBShared.Weapons = { [`weapon_pistol`] = { -- Weapon hash (uses compile-time Jenkins hashes - See link at bottom of page) ['name'] = 'weapon_pistol', -- Actual item name for spawning/giving/removing ['label'] = 'Walther P99', -- Label of item that is shown in inventory slot ['weight'] = 1000, -- How much the items weighs ['type'] = 'weapon', -- What type the item is (ex: item, weapon) ['ammotype'] = 'AMMO_PISTOL', -- The type of ammo this weapon accepts ['image'] = 'weapon_pistol.png', -- This item image that is found in qb-inventory/html/images (must be same name as ['name'] from above) ['unique'] = true, -- Is the item unique (true|false) - Cannot be stacked & accepts item info to be assigned ['useable'] = false, -- Is the item useable (true|false) - Must still be registered as useable ['description'] = 'A small firearm designed to be held in one hand' -- Description of time in inventory }}
    Shared | QBCore Documentation (2024)
    Top Articles
    Chimpan-A to Chimpan-Z
    John McKinney Saxon (1879-1958) - Find a Grave...
    Mchoul Funeral Home Of Fishkill Inc. Services
    Blorg Body Pillow
    The UPS Store | Ship & Print Here > 400 West Broadway
    Faridpur Govt. Girls' High School, Faridpur Test Examination—2023; English : Paper II
    Winston Salem Nc Craigslist
    Www.politicser.com Pepperboy News
    Bhad Bhabie Shares Footage Of Her Child's Father Beating Her Up, Wants Him To 'Get Help'
    Elden Ring Dex/Int Build
    Truist Drive Through Hours
    Strange World Showtimes Near Cmx Downtown At The Gardens 16
    DIN 41612 - FCI - PDF Catalogs | Technical Documentation
    Transformers Movie Wiki
    Sarpian Cat
    Committees Of Correspondence | Encyclopedia.com
    Dirt Removal in Burnet, TX ~ Instant Upfront Pricing
    Urban Airship Expands its Mobile Platform to Transform Customer Communications
    3476405416
    623-250-6295
    Quick Answer: When Is The Zellwood Corn Festival - BikeHike
    Katie Sigmond Hot Pics
    Boscov's Bus Trips
    Drug Test 35765N
    Atlases, Cartography, Asia (Collection Dr. Dupuis), Arch…
    Sand Dollar Restaurant Anna Maria Island
    Meta Carevr
    JVID Rina sauce set1
    Mchoul Funeral Home Of Fishkill Inc. Services
    Ixlggusd
    The Wichita Beacon from Wichita, Kansas
    Mgm Virtual Roster Login
    Greencastle Railcam
    B.k. Miller Chitterlings
    What Time Is First Light Tomorrow Morning
    Montrose Colorado Sheriff's Department
    2024 Ford Bronco Sport for sale - McDonough, GA - craigslist
    Reborn Rich Ep 12 Eng Sub
    Instafeet Login
    About :: Town Of Saugerties
    2700 Yen To Usd
    Craigslist Freeport Illinois
    062203010
    All Characters in Omega Strikers
    Smite Builds Season 9
    Cvs Coit And Alpha
    Canada Life Insurance Comparison Ivari Vs Sun Life
    8 4 Study Guide And Intervention Trigonometry
    Star Sessions Snapcamz
    Spn 3464 Engine Throttle Actuator 1 Control Command
    Runescape Death Guard
    Fallout 76 Fox Locations
    Latest Posts
    Article information

    Author: Jamar Nader

    Last Updated:

    Views: 5989

    Rating: 4.4 / 5 (55 voted)

    Reviews: 94% of readers found this page helpful

    Author information

    Name: Jamar Nader

    Birthday: 1995-02-28

    Address: Apt. 536 6162 Reichel Greens, Port Zackaryside, CT 22682-9804

    Phone: +9958384818317

    Job: IT Representative

    Hobby: Scrapbooking, Hiking, Hunting, Kite flying, Blacksmithing, Video gaming, Foraging

    Introduction: My name is Jamar Nader, I am a fine, shiny, colorful, bright, nice, perfect, curious person who loves writing and wants to share my knowledge and understanding with you.