Hi everyone! Today I’m releasing one of my free resources that’s been sitting in my github for a while. This resource will make you be able to forge some legal documents for yourself. It supports the item types of the QBCore but you can add any item with the metadata.
Preview
Features
Preview
Features
- Forge default document types
- ID Card
- Driver License
- Weapon License
- Lawyer Pass
- Supports both qb-target or PolyZone
- This resource uses the latest QBCore so needed items added automatically when resource starts but if you want to add the items to shared/items.lua, here you go.
-
Code:
shared/items.lua["blank_card"] = {["name"] = "blank_card", ["label"] = "Blank Card", ["weight"] = 100, ["type"] = "item", ["image"] = "blank_card.png", ["unique"] = false, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "This blank card can be turned into anything under a professional hands"}, ["blank_usb"] = {["name"] = "blank_usb", ["label"] = "Blank USB", ["weight"] = 100, ["type"] = "item", ["image"] = "usb_device.png", ["unique"] = false, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "This blank USB stick can be turned into anything under a professional hands"}, ["usb"] = {["name"] = "usb", ["label"] = "USB", ["weight"] = 100, ["type"] = "item", ["image"] = "usb_device.png", ["unique"] = true, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "This USB stick contains some information"}, ["corrupted_card"] = {["name"] = "corrupted_card", ["label"] = "?????", ["weight"] = 100, ["type"] = "item", ["image"] = "blank_card.png", ["unique"] = true, ["useable"] = false, ["shouldClose"] = false, ["combinable"] = nil, ["description"] = "?????"},
Dependencies
- - Inventory system for the QBCore Framework
- - Menu System for the QBCore Framework
- - Targeting solution for the QBCore Framework
- - NUI input system for the QBCore Framework
Installation
- Download the script and put it in the [qb] directory.
- Add the following line after your GetStashItems() function.exports('GetStashItems', GetStashItems)
- Example
-
Code:
– Stash Items local function GetStashItems(stashId) local items = {} local result = MySQL.Sync.fetchScalar(‘SELECT items FROM stashitems WHERE stash = ?’, {stashId}) if result then local stashItems = json.decode(result) if stashItems then for k, item in pairs(stashItems) do local itemInfo = QBCore.Shared.Items[item.name:lower()] if itemInfo then items[item.slot] = { name = itemInfo[“name”], amount = tonumber(item.amount), info = item.info or “”, label = itemInfo[“label”], description = itemInfo[“description”] or “”, weight = itemInfo[“weight”], type = itemInfo[“type”], unique = itemInfo[“unique”], useable = itemInfo[“useable”], image = itemInfo[“image”], slot = item.slot, } end end end end return items end exports(‘GetStashItems’, GetStashItems)
Configuration
Example
Code:ConfigConfig = Config or {} Config.UseTarget = GetConvar('UseTarget', 'false') == 'true' Config.ForgeryOffice = { coords = { ["enter"] = vector4(-618.6, 301.94, 82.25, 84.51), ["forgerydetails"] = vector3(1159.71, -3199.26, -39.25), ["forgerydetailsZone"] = vector3(1161.38, -3198.4, -39.01), ["printdocument"] = vector3(1163.6, -3195.35, -39.25), ["printdocumentZone"] = vector3(1163.64, -3194.69, -39.01), ["exit"] = vector4(1173.61, -3196.67, -39.01, 94.11), }, polyzoneBoxData = { ["enter"] = { heading = -5, debug = true, length = 1, width = 1, distance = 2.0, created = false }, ["forgerydetails"] = { heading = 180, debug = true, length = 1, width = 1, distance = 2.0, created = false }, ["forgerydetailsZone"] = { heading = 180, debug = true, length = 1, width = 1, distance = 2.0, created = false }, ["printdocument"] = { heading = 180, debug = true, length = 1, width = 1, distance = 2.0, created = false }, ["printdocumentZone"] = { heading = 180, debug = true, length = 1, width = 1, distance = 2.0, created = false }, ["exit"] = { heading = 180, debug = true, length = 1, width = 1, distance = 2.0, created = false } }, }
How can I use forged weapon license with weapon shops?
We need to edit and add some functions to qb-shops/client/main.lua.
- First we need to comment/delete the line 81 in client/main.lua. After that we need to add “if licenseCheck() then” or “if licenseCheckWithPlayerData() then” line accordingly what you want.
-
Code:
local function openShop(shop, data) [*] [*] [*] [/LIST] local ShopItems = {} ShopItems.items = {} ShopItems.label = data["label"] if data.type == "weapon" and Config.FirearmsLicenseCheck then if licenseCheck() then --if licenseCheckWithPlayerData() then --if PlayerData.metadata['licenses'] and PlayerData.metadata["licences"].weapon and QBCore.Functions.HasItem("weaponlicense") then ShopItems.items = SetupItems(shop) QBCore.Functions.Notify(Lang:t("success.dealer_verify"), "success") Wait(500) else ShopItems.items = SetupItems(shop, true) QBCore.Functions.Notify(Lang:t("error.dealer_decline"), "error") Wait(500) QBCore.Functions.Notify(Lang:t("error.talk_cop"), "error") Wait(1000) end else ShopItems.items = SetupItems(shop) end for k in pairs(ShopItems.items) do ShopItems.items[k].slot = k end TriggerServerEvent("inventory:server:OpenInventory", "shop", "Itemshop_" .. shop, ShopItems) end
- Next we will add some helper functions above openShop() function.
- Since these are local functions please beware these needs to be in the correct order and before the openShop() function.
-
Code:
local function getSlotsOfItem(plyItems, itemName) local slotsFound = {} if not plyItems then return slotsFound end for slot, item in pairs(plyItems) do if item.name:lower() == itemName:lower() then slotsFound[#slotsFound+1] = slot end end return slotsFound end local function getItemsByName(item) local plyItems = QBCore.Functions.GetPlayerData().items item = tostring(item):lower() local items = {} local slots = getSlotsOfItem(plyItems, item) for _, slot in pairs(slots) do if slot then items[#items+1] = plyItems[slot] end end return items end local function licenseCheck() local weaponlicenses = getItemsByName('weaponlicense') local id_cards = getItemsByName('id_card') if weaponlicenses and id_cards then for _, weaponlicense in pairs(weaponlicenses) do for _, id_card in pairs(id_cards) do if weaponlicense.info.firstname == id_card.info.firstname and weaponlicense.info.lastname == id_card.info.lastname then return true end end end end return false end local function licenseCheckWithPlayerData() local weaponlicenses = getItemsByName('weaponlicense') if weaponlicenses then for _, weaponlicense in pairs(weaponlicenses) do local PlayerData = QBCore.Functions.GetPlayerData() if weaponlicense.info.firstname == PlayerData.charinfo.firstname and weaponlicense.info.lastname == PlayerData.charinfo.lastname then return true end end end return false end
- Since these are local functions please beware these needs to be in the correct order and before the openShop() function.
- Next we will add some helper functions above openShop() function.