🆔Identification System
Installation Guide for the [QB/QBX/ESX] Identification Script!




Step 1 - SQL Upload
The script autmatically handles all database uploads for player headshots using the players table for QB and QBX and the users table for ESX.
If your framework uses something different for storing players then this system will NOT work for you.
Step 2 - Configuration
To navigate to the config.lua file within the script, follow these steps:
- Locate the script folder: Find the directory where the script is installed on your server. It might be inside a resource folder or directly in the server's resources directory. I recommend adding to a folder called [xmmx] then ensuring this folder last in your server.cfg. 
- Access the script folder: Open the folder that corresponds to this script. Which should be: xmmx_identification, please do not rename the script or it will stop working! 
- Find the - config.luafile: Within the script folder, look for a file named- config.lua. This file contains various settings and configurations for the script.
- Edit the desired settings: Once you locate the - config.luafile, open it using a text editor or code editor. You can modify the settings such as- Version,- Debug Option,- Distance,- Duration, to customize the script according to your server's specifications. Next locate the `sv_config.lua` file within the configs folder. Here is where you will set your discord webhook or fivemerr API token for screenshot uploads. This is required for full use of the script. You must also have screenshot-basic in order for the script to work.
- Please review the config thoroughly and read each side-note as to ensure correct installation of the resource. Be sure to add the images from xmmx_identification/INSTALL/images to your inventories images folder. Replace any duplicate images when prompted. 
- Save the changes: After making the necessary adjustments to the settings, save the - config.luafile.
Remember to restart the script or resource for the changes to take effect in your server. Always make sure to follow the script's documentation and any additional instructions provided by the script creator when making changes to the configuration file.
    Version         = true,                     -- Enable Version Checks?
    Debug           = false,                    -- Enable Debug Prints and Target Zones?
    Distance        = 2.0,                      -- Target/Interaction Distance.
    NearbyDist      = 15.0,                     -- Show players within this distance in the UI.
Step 3 - Items
There are 2 items pre-configured in the script (id_card and badge). The id_card item should come default in qb-core and qbx_core, but if it doesn't then you will need to add it along with the badge item to your shared/items.lua. Check the README.md for instructions.
Next, Copy and Paste the lines below into qb-core/shared/items.lua. These are required in order for the script to work! The 1st three are default QBCore Items, so locate and remove or comment them out, then copy and paste all the items below to use the matching item images.
    -- Default QB-Core Items:
    ['id_card']                         = {['name'] = 'id_card',                           ['label'] = 'ID Card',                   ['weight'] = 0,            ['type'] = 'item',         ['image'] = 'id_card.png',                 ['unique'] = true,          ['useable'] = true,     ['shouldClose'] = true,      ['combinable'] = nil,   ['description'] = 'A card containing all your information to identify yourself'},
    ['driver_license']                  = {['name'] = 'driver_license',                    ['label'] = 'Drivers License',           ['weight'] = 0,            ['type'] = 'item',         ['image'] = 'driver_license.png',          ['unique'] = true,          ['useable'] = true,     ['shouldClose'] = true,      ['combinable'] = nil,   ['description'] = 'Permit to show you can drive a vehicle'},
    ['weaponlicense']                   = {['name'] = 'weaponlicense',                     ['label'] = 'Weapon License',            ['weight'] = 0,            ['type'] = 'item',         ['image'] = 'weaponlicense.png',           ['unique'] = true,          ['useable'] = true,     ['shouldClose'] = true,       ['combinable'] = nil,   ['description'] = 'Weapon License'},
    
    -- New Identification Types:
    ["fishinglicense"] 			= {["name"] = "fishinglicense", 		   ["label"] = "Fishing License", 	    ["weight"] = 1, 	       ["type"] = "item", 	  ["image"] = "fishinglicense.png", 	     ["unique"] = true, 	 ["useable"] = true, 	 ["shouldClose"] = false,      ["combinable"] = nil,   ["description"] = "Permit to show officals that you can legally fish."},
    ["huntinglicense"] 			= {["name"] = "huntinglicense", 		   ["label"] = "Hunting License", 	    ["weight"] = 1, 	       ["type"] = "item", 	  ["image"] = "huntinglicense.png", 	     ["unique"] = true, 	 ["useable"] = true, 	 ["shouldClose"] = false,      ["combinable"] = nil,   ["description"] = "Permit to show officals that you can legally hunt."},
    ["pilotlicense"] 			= {["name"] = "pilotlicense", 			   ["label"] = "Pilot License", 	    ["weight"] = 1, 	       ["type"] = "item", 	  ["image"] = "pilotlicense.png", 	     ["unique"] = true, 	 ["useable"] = true, 	 ["shouldClose"] = false,      ["combinable"] = nil,   ["description"] = "Permit to show officals that you can fly an aircraft."},
    ["cannabiscard"] 			= {["name"] = "cannabiscard", 			   ["label"] = "Medical Cannabis Card",     ["weight"] = 1, 	       ["type"] = "item", 	  ["image"] = "cannabiscard.png", 	     ["unique"] = true, 	 ["useable"] = true, 	 ["shouldClose"] = false,      ["combinable"] = nil,   ["description"] = "Permit to show officals that you can possess cannabis."},
    ["employeebadge"] 			= {["name"] = "employeebadge", 			   ["label"] = "Employee Badge", 	    ["weight"] = 1, 	       ["type"] = "item", 	  ["image"] = "employeebadge.png", 	     ["unique"] = true, 	 ["useable"] = true, 	 ["shouldClose"] = false,      ["combinable"] = nil,   ["description"] = "A badge to prove your employment credentials."},
    ["businesslicense"] 		= {["name"] = "businesslicense", 		   ["label"] = "Business License", 	    ["weight"] = 1, 	       ["type"] = "item", 	  ["image"] = "businesslicense.png", 	     ["unique"] = true, 	 ["useable"] = true, 	 ["shouldClose"] = false,      ["combinable"] = nil,   ["description"] = "Permit to show that you are an Official Business Owner."},This asset has an open-source bridge integrated directly within the script. Here is where you can check and configure your framework, target system, inventory system etc.
Step 4 - Locations
Configure your target location and jobs able to target those location in the Locations table of the config.lua. You can have infinite locations.
    Locations = {
        { 
            name    = "mrpd_default",   
            coords  = vec3(436.4807, -984.0323, 31.2081),  
            heading = 0.0, 
            width   = 0.5, 
            length  = 0.3, 
            height  = 0.4,
            job = { 
                ["police"] = 0,
                ["ambulance"] = 0,
            } 
        },
    }, Step 5 - JobAccess
In the JobAccess section of the config is where you will configure which jobs and grades have access to issue specific identifications:
    JobAccess = {         
        ["idcard"]   = { police = 0, judge = 0 },
        ["driver"]   = { police = 0 },
        ["weapon"]   = { police = 0 },
        ["pilot"]    = { police = 0 },
        ["fishing"]  = { police = 0 },
        ["hunting"]  = { police = 0 },
        ["cannabis"] = { ambulance = 0, police = 0 },
        ["business"] = { judge = 0, police = 0 },
        ["employee"] = { police = 0, ambulance = 0, judge = 0 },
        ["headshot"] = { police = 0, judge = 0 },
    },Step 6 - Logos
In this section, you can easily configure the usage of badges for specific jobs by adding the desired job names along with the corresponding URL for the logo of each job. This will allow players with those jobs to display their designated badges in the game.
Simply follow these steps:
- Set Logo URLs: For each job you want, specify the URL that points to the logo or badge image you want to associate with that job. Make sure the URL is accurate and points to the correct image file. Alternatively, you can add the logo images to the xmmx_identification/web/images/ folder then link them in the config directly. 
By completing these simple steps, you can customize the badge system to suit your server's needs, allowing players with designated jobs to proudly display their respective badges in the game.
    SealURLs = { 
        -- ["police"]   = 'https://r2.fivemanage.com/XXXXXXXXXXXXXXXXXXXXX/lspd.png',           -- example for loading image from a CORS URL provider. (Fivemanage.com)
        ["default"]     = 'https://cfx-nui-xmmx_identification/web/images/default.webp',        -- default in-case job and seal isn't listed.
        ["business"]    = 'https://cfx-nui-xmmx_identification/web/images/blseal.webp',         -- the business license seal
        -- add yours or edit below here
        ["police"]      = 'https://cfx-nui-xmmx_identification/web/images/lspd.webp',           -- example for loading image locally from ui/images folder.
        ["ambulance"]   = 'https://cfx-nui-xmmx_identification/web/images/pillbox.webp',
        ["lawyer"]      = 'https://cfx-nui-xmmx_identification/web/images/doj.webp',
        ["catcafe"]     = 'https://cfx-nui-xmmx_identification/web/images/catcafe.webp',         
    },Step 7 - Card Options
In this section is where you will configure the info required for the identifications as well as the item that will trigger the UI.
    Options = {
        {
            type    = 'idcard', 
            item    = 'id_card',
            title   = 'Identification Card',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Expiration Date.',
            icon    = 'fas fa-address-card',
        },
        {
            type    = 'driver',
            item    = 'driver_license',
            title   = 'Drivers License',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• License Class\n• Expiration Date.',
            icon    = 'fas fa-id-card',
            requiresClass = true,
        },
        {
            type    = 'weapon',
            item    = 'weaponlicense',
            title   = 'Weapon License',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Expiration Date.',
            icon    = 'fas fa-person-rifle',
        },
        {
            type    = 'pilot',
            item    = 'pilotlicense',
            title   = 'Pilot License',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Expiration Date.',
            icon    = 'fas fa-id-card-clip',
        },
        {
            type    = 'fishing',
            item    = 'fishinglicense',
            title   = 'Fishing License',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Expiration Date.',
            icon    = 'fas fa-fish',
        },
        {
            type    = 'hunting',
            item    = 'huntinglicense',
            title   = 'Hunting License',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Expiration Date.',
            icon    = 'fas fa-cow',
        },
        {
            type    = 'cannabis',
            item    = 'cannabiscard',
            title   = 'Medical Cannabis Card',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Expiration Date.',
            icon    = 'fas fa-cannabis',
        },
        {
            type    = 'business',
            item    = 'businesslicense',
            title   = 'Business License',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Business Name\n• Expiration Date.',
            icon    = 'fas fa-folder-open',
            requiresBusiness = true,
            requiresSigner = true,
        },
        {
            type    = 'employee',
            item    = 'employeebadge',
            title   = 'Employee Badge',
            desc    = 'REQUIREMENTS: \n • Player ID #\n• Expiration Date\n• Callsign or Badge #.',
            icon    = 'fas fa-id-badge',
            requiresCallsign = true,
        },        
    },Step 8 - Locales
Self explanatory. Here is where you configure your language preference.
    Locales = {
        target = {
            label               = "ID MANAGEMENT",
            color               = "#1741cc", -- color, hex, or rgb (if colors supported) 
        },
        notify = {
            not_authorized      = "You are not authorized to use this badge!",
            url_uploaded        = "Headshot URL updated for Citizen Identifier: %s",
            upload_failed       = "Failed to update Headshot URL for Identifier: %s",
            invalid_input       = "Invalid input for headshot URL",
            no_playerid         = "No one online with ID #:  %s", 
            id_cooldown         = "You must wait a few seconds to display your card again!",
        },
        classes = {
            drive_learner       = "CP - Learner",
            drive_permanent     = "C - Driver",
            drive_commercial    = "A - Commercial",
            drive_truckprov     = "AP (Provisional)",
            drive_cycle         = "M - Motorcycle",
            drive_cycleprov     = "MP (Provisional)",  
        }      
    }Last updated
