[QB][FREE] - qb-forgeryoffice | Forging Legal Documents

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

qb-forgeryoffice

Features
  • Forge default document types
    1. ID Card
    2. Driver License
    3. Weapon License
    4. 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.
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


Installation

  • Download the script and put it in the [qb] directory.
  • Add the following line after your GetStashItems() function.
    exports('GetStashItems', GetStashItems)
    
Example

– 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 Config
Config = 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.

  1. 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.
local function openShop(shop, data)
    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
  1. 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.
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

Download Link (GitHub)
qb-forgeryoffice: Document Forgery Office Script using qb-target/PolyZone and GTA:O IPL with bob74_ipl

Check out my other scripts:

Scripts

[ESX][QB][Custom Framework][PAID] - zxn-rpgNPC | RPG-like dialogues with NPCs v1.2.0
[QB][PAID] - zxn-multicharacter | EchoRP “inspired” - FiveM Resource Development & Modding / Releases - Cfx.re Community

7 Likes

possibel to make it for esx ?

Maybe later, I didn’t create it with the thought of ESX so I don’t know if this can be easily translated to it. If anyone willing to make it for ESX always can do a fork and I can add it here in the topic and give credit.

2 Likes

Please do

1 Like

For the weapon license, it create the actual card but when going to use ammunation, cops still need to grant the license.

Yes it doesn’t grant the license in the PlayerData because this document is fake :thinking: I mean I was using this in a server which I had a modified qb-core so there was not a license table in the PlayerData. So the players could forge any legal document like this. If you like to grant the actual license you can do that with a couple of lines of code but it’d make no sense for me :confused:

I want it to be where the weapon dealer only looks for an actual item like the forged weapon license from your script and not look for the actual grant, if this is possible do you know where I would change this? because this script would be so dope!

Oh, I understand now. I’ll dm you for a guide how you can do that :slight_smile:

It uses Locale thing, did they remove it?
Edit: Just remove the if statement in line 36 in locales/en.lua. It checks the language convar in the server config.

oh pls, send to me too!

1 Like

Yes, exactly, I’m sorry I didn’t look at that file)

1 Like

No problem, I’m here to help :slight_smile:

I edited the topic and created a little guide inside How can I use forged weapon license with weapon shops? part of my original post. @iamsickflowz @Joeystreamz You can take a look.

Good!!! Got it!

1 Like

Can I somehow make it so that the police can issue the same documents via qb-radialmenu? Having only a printer and an empty form nearby?

Never thought about it because this resource’s main purpose is to create legal documents while avoiding police and stuff. But there should be an example in qb-cityhall resource, where you can get an id card, driver license and weapon license (from PlayerData). You can look at it at qb-cityhall/server/main.lua line 44. If you still have question, you can contact me via DM.

Where do i put this??

If you are using qb-inventory you can put that after GetStashItems function. It should be inside of qb-inventory/server/main.lua.

i have Qb-shops but my script looks different the yours. do you think you could help me out with the weapon license part

Yes of course, can you send me a PM with some details and errors if there is any?