fnx-idcard

individual document system based on metadata

Requirements

Basic info

If you have purchased the escrow version of the resource, you will have access to support via ticket, we remind you that this resource currently only works with ox_inventory and quasar inventory metadata

This script need to be configurated, is not plug and play, then first of all go to the config.lua and choose you inventory and other config as you like

Im using ox_inventory

add this in the item storange of ox inventory

['documents'] = {
    label = 'ID Card',
    weight = 0.03,
    stack = true,
    close = true,
},

['drive'] = {
    label = 'Drive License',
    weight = 0.03,
    stack = true,
    close = true,
},

['weapon'] = {
    label = "Weapon License",
    weight = 0.03,
    stack = true,
    close = true,
},
['cryptostick'] = {
    label = 'crypto stick',
    weight = 200,
    stack = true,
    close = true,
    description = "Why would someone ever buy money that doesn't exist.. How many would it contain..?"
},

Im using qs-inventory or qb-inventory or lj-inventory

Add this item in qs inventory or in qb / lj inventory

["documents"] = {
    ["name"] = "documents",
    ["label"] = "documents",
    ["weight"] = 1,
    ["type"] = "item",
    ["image"] = "id-card.png",
    ["unique"] = true,
    ["useable"] = true,
    ["shouldClose"] = true,
    ["combinable"] = nil,
    ["description"] = "Documenti."
},
["drive"] = {
    ["name"] = "drive",
    ["label"] = "drive",
    ["weight"] = 1,
    ["type"] = "item",
    ["image"] = "drive.png",
    ["unique"] = true,
    ["useable"] = true,
    ["shouldClose"] = true,
    ["combinable"] = nil,
    ["description"] = "Documenti."
},
["weapons"] = {
    ["name"] = "weapons",
    ["label"] = "weapons",
    ["weight"] = 1,
    ["type"] = "item",
    ["image"] = "weapons.png",
    ["unique"] = true,
    ["useable"] = true,
    ["shouldClose"] = true,
    ["combinable"] = nil,
    ["description"] = "Weapon License"
},

["cryptostick"] = {
    ["name"] = "cryptostick",
    ["label"] = "cryptostick",
    ["weight"] = 1,
    ["type"] = "item",
    ["image"] = "cryptostick.png",
    ["unique"] = false,
    ["useable"] = true,
    ["shouldClose"] = true,
    ["combinable"] = nil,
    ["description"] = "Special item."
},

Im using core-inventory

Insert this in your database

// run the code below in your database

INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`, `x`, `y`, `category`, `componentTint`, `componentHash`, `backpackModel`, `backgroundTexture`, `description`) VALUES ('documents', 'documents', 4, 0, 1, 1, 1, 'documents', NULL, NULL, NULL, NULL, 'An item');
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`, `x`, `y`, `category`, `componentTint`, `componentHash`, `backpackModel`, `backgroundTexture`, `description`) VALUES ('drive', 'drive', 4, 0, 1, 1, 1, 'documents', NULL, NULL, NULL, NULL, 'An item');
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`, `x`, `y`, `category`, `componentTint`, `componentHash`, `backpackModel`, `backgroundTexture`, `description`) VALUES ('weapon', 'weapon', 4, 0, 1, 1, 1, 'documents', NULL, NULL, NULL, NULL, 'An item');
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`, `x`, `y`, `category`, `componentTint`, `componentHash`, `backpackModel`, `backgroundTexture`, `description`) VALUES ('cryptostick', 'cryptostick', 4, 0, 1, 1, 1, 'documents', NULL, NULL, NULL, NULL, 'An item');
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`, `x`, `y`, `category`, `componentTint`, `componentHash`, `backpackModel`, `backgroundTexture`, `description`) VALUES ('boat', 'boat', 4, 0, 1, 1, 1, 'documents', NULL, NULL, NULL, NULL, 'An item');
INSERT INTO `items` (`name`, `label`, `weight`, `rare`, `can_remove`, `x`, `y`, `category`, `componentTint`, `componentHash`, `backpackModel`, `backgroundTexture`, `description`) VALUES ('plane', 'plane', 4, 0, 1, 1, 1, 'documents', NULL, NULL, NULL, NULL, 'An item');

Create this in ItemCategories in the config.lua

 ["documents"] = {
        color = "#f2f2f2",
        takeSound = 'take',
        putSound = 'put',
        stack = 1
  },

Go to the CloseAfterUse config and replace with this line or add in the table the following items

 "documents", "weapon", "drive", "plane", "boat"

I have date of birth error, how can i fix?

if you have this error, or a similar error remember to check the config.js

check the config.js

Select the right data format and the right data separator according to the examples

How can i give the weapon license menu to my police script?

License menu trigger:

TriggerEvent('fnx_idCard:weaponLicense')

if you want the trigger to give and retrive the license without open the menu, see the following code lines

To give:

-- esx
local c, dis = ESX.Game.GetClosestPlayer()
TriggerServerEvent("fnx_idCard:givefirearm", GetPlayerServerId(c))

-- qbcore
local c, dis = QBCore.Functions.GetClosestPlayer()
TriggerServerEvent("fnx_idCard:givefirearm", GetPlayerServerId(c))

To retrive:

-- esx
local c, dis = ESX.Game.GetClosestPlayer()
TriggerServerEvent("fnx_idCard:retirefirearm", GetPlayerServerId(c))

-- qbcore
local c, dis = QBCore.Functions.GetClosestPlayer()
TriggerServerEvent("fnx_idCard:retirefirearm", GetPlayerServerId(c))

To give the license to yourself, not to the nearest player (for ESX and QBCORE):

-- give
TriggerServerEvent("fnx_idCard:givefirearm", GetPlayerServerId(PlayerId()))

-- retrive
TriggerServerEvent("fnx_idCard:retirefirearm", GetPlayerServerId(PlayerId()))

example in policejob

How can i trigger the illegal dialog?

This is the trigger to open the document forgery menu, the topic and to whom the menu should be opened.

local args = source -- server id player 
TriggerClientEvent('fnx_idcard:dialogIllegal', args)

How can i update the photo by trigger?

This is the trigger to update a person's photo, this person updates it directly in the database

  1. -- event registered
    RegisterServerEvent('fnx_idcard:updatePhoto',function(link)
        local source = source
        local xPlayer = ServerGetPlayer(source)
        MySQL.Async.execute('UPDATE users SET idCardPhoto = ? WHERE identifier = ?', {link, xPlayer.identifier})            
    end)
    
    -- how to trigger
    link = "" -- link of the new picture
    TriggerServerEvent('fnx_idcard:updatePhoto', link)
    
    -- example in a command
    RegisterCommand('updatephoto', function(arg)
        if arg[1] ~= nil then 
            TriggerServerEvent('fnx_idcard:updatePhoto', arg[1])
        else 
            print('You miss the argument for this command.')
        end 
    end
    

How can i open the document creation menu?

Here you will find the trigger to open the photo creation menu, and you can integrate it and place it wherever you want.

-- to open the ID document creation menu
TriggerEvent('fnx_idcard:takePhotoMoveCam')

You can use this trigger in qb-cityhall to make the photo and give the documents

How can i give the drive license to a player?

The licenses that the player owns are automatically detected by the esx_license, in the user_license table

-- ESX
local c, dis = ESX.Game.GetClosestPlayer()
TriggerServerEvent("fnx_idcard:giveDriveLicenseToPlayer",GetPlayerServerId(c))

-- QBCORE
local c, dis = QBCore.Functions.GetClosestPlayer()
TriggerServerEvent("fnx_idcard:giveDriveLicenseToPlayer",GetPlayerServerId(c))

How can i give the license to myself? (SAME FOR ESX AND QBCORE)

TriggerServerEvent("fnx_idcard:giveDriveLicenseToPlayer",GetPlayerServerId(PlayerId()))

How can i create a document plus?

Follow this step to create a custom document:

  1. First of all create the item in your inventory

  2. test = name of the item, illegalallowed = if must be or not in the fake document menu, bg = image background of the item

How can i give and retrive a document plus?

To create a document plus, you have to follow the guide lines in the config.lua, after that all was created. When you have created the document plus, to give it, you must use this trigger, that you can implement in your menu or command etc etc:

-- ESX
local c, dis = ESX.Game.GetClosestPlayer() -- id of the player that you want give the license
local license = "plane" -- name of the license 
 
TriggerServerEvent("fnx_idCard:giveDocumentPlus", GetPlayerServerId(c),license)

-- QBCORE
local c, dis = QBCore.Functions.GetClosestPlayer()
local license = "plane" -- name of the license 
 
TriggerServerEvent("fnx_idCard:giveDocumentPlus", GetPlayerServerId(c),license)

to retrive, just use this trigger with the right target

-- ESX
local c, dis = ESX.Game.GetClosestPlayer() -- id of the player that you want give the license
local license = "plane" -- name of the license 

TriggerServerEvent("fnx_idCard:retireDocumentPlus",GetPlayerServerId(c),license)

-- QBCORE
local c, dis = QBCore.Functions.GetClosestPlayer()
local license = "plane" -- name of the license 

TriggerServerEvent("fnx_idCard:retireDocumentPlus",GetPlayerServerId(c),license)

Last updated