πŸ†”[QB] Identification

Installation Guide for the [QB] Identification Script!

Step 1 - SQL Upload

Locate in the INSTALL folder, the headshots.sql file. Alternatively, you may copy and paste the below then run it in your servers database.

ALTER TABLE `players` ADD `headshots` VARCHAR(255);

This is needed in order to store, retrieve, and display the headshot images on the ID-Card and/or Badges.

Next, you will need to add the new license types to qb-core. Navigate to qb-core/server/player.lua and look for the table below. Copy and paste the new license types to the table: Example:

PlayerData.metadata['licences'] = PlayerData.metadata['licences'] or {
    -- First 3 should already be in your licences metadata table.
    ['driver'] = true, -- Setting "true" means license is granted automatically.
    ['business'] = false,
    ['weapon'] = false,
    -- added from xmmx_identification
    ['hunting'] = false,
    ['fishing'] = false,
    ['pilot'] = false,
    ['cannabis'] = false
}

Step 2 - Configuration

To navigate to the config.lua file within the script, follow these steps:

  1. 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. If updating from [QB] ID-Card, please remove the old resource completely.

  2. 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!

  3. Find the config.lua file: Within the script folder, look for a file named config.lua. This file contains various settings and configurations for the script.

  4. Edit the desired settings: Once you locate the config.lua file, open it using a text editor or code editor. You can modify the settings such as VersionCheck, Core, Debug Option, Distance, Duration, and BDuration to customize the script according to your server's specifications.

  5. 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.

  6. Save the changes: After making the necessary adjustments to the settings, save the config.lua file.

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.

    VersionCheck = true, -- true or false, Enable or Disable Version Checks.

    --[[ FRAMEWORK & GENERAL SETTINGS ]]
    Core = 'qb-core', -- Framework Export (Currently only QBCore or renamed QBCore's)
    
    Debug = false, -- Debug Print for Error Checking, and/or Target Zone.

    Distance = 2.0, -- Distance to other players for the UI to display to other players.

    IDuration = 6000, -- Time in ms the ID UI is displayed. (6000 = 6 seconds)
    BDuration = 6000, -- Time in ms the Badge UI is displayed. (6000 = 6 seconds)

Step 3 - Items

There are 2 items pre-configured in the script (id_card and badge). The id_card item should come default with QBCore, but if it doesn't then you will need to add it along with the badge item to your shared/items.lua.

You may also change the items to whatever you choose in the config.

    Item = 'id_card',         --  The default name of your ID Card Item or create a new item in your core.
    BItem = 'badge',          -- The name of the badge item.

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'] = false,      ['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'] = false,      ['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."},

Step 4 - Utilities

Locate the Utilities Settings in the config.lua file, follow the steps below:

  1. Open the config.lua file: Navigate to the script folder as described earlier and open the config.lua file using a text editor or code editor.

  2. Find the Utilities Settings section: In the config.lua file, search for the section related to Utilities Settings. It might be labeled as "Utilities Settings" or something similar.

  3. Configure the Target System: In this section, you can set your server's Target System to one of the three available options: "qb," "ox," or "qt." Choose the appropriate Target System that matches the framework your server is using.

  4. Choose Notifications and Input Settings: You have the option to use either the default "qb" settings for notifications and input, or if you have the "ox_lib" resource installed, you can use "ox" for notifications and input.

  5. Save the changes: After configuring the Utilities Settings to your preferences, save the config.lua file.

An example of what this section looks like in the config.lua file:

Config.Utilities = {
    -- Set your server's Target System to one of the following: "qb", "esx", "vrp"
    TargetSystem = "qb",

    -- Choose the notification and input system: "qb" (default) or "ox" if you have "ox_lib" installed.
    NotificationSystem = "qb",
    InputSystem = "qb",
}

License Types and Jobs

There are 4 options pre-configured for assigning jobs to license types. OptionA, OptionB, OptionC, and OptionD. A list of the different license types is located at the top of the config.lua.

Each option contains rank, jobs, and licenses. When assigning a job(s), adjust the rank at which the jobs listed will be able to give or revoke a license.

    --[[ JOBS, RANKS, AND LECENSE TYPES ]]
    OptionA = {                                           
        rank = 2,                                       -- pre-configured to most police issued licenses.
        jobs = { "police", "sheriff" },                 -- must be this rank or higher to give a license for the listed jobs below.
        licenses = {                                    -- the list of jobs allowed to grant the licenses below
            "driver", 
            "weapon", 
            "pilot",                                    -- also included below in case you create a pilot job or move licenses as you'd like. =)
            "hunting", 
            "fishing" 
        },
    },
    OptionB = {                                          -- pre-configured to medical job issued license.
        rank = 2,
        jobs = { "ambulance" },
        licenses = { 
            "cannabis", 
        },
    },
    OptionC = {                                          -- pre-configured to governement job issued license.
        rank = 0,
        jobs = { "lawyer" },
        licenses = { 
            "business", 
        },
    },
    OptionD = {                                           -- pre-configured to governement job issued license.
        rank = 0,
        jobs = { "pilot" },
        licenses = { 
            "pilot",
        },
    },

Before finalizing the configuration, be certain to choose the suitable options according to your server's specific setup. Once you've made the necessary changes, save the file and proceed to restart the script or resource to apply the modifications. Remember to diligently follow the script's documentation or any accompanying instructions to ensure seamless integration and optimal performance.

    --[[ UTILITIES SETTINGS QB/OX ]]
    Target = "qb", -- "qb" for qb-target, "qt" for qtarget, or "ox" for ox_target

    Notify = "qb", --"ox" for ox_lib Notifications, or "qb" for QBCore Notifications.

    Input = "qb", -- "ox" for ox_lib input, or "qb" for qb-input.

Step 5 - Target Setup

In the Config.lua file, you'll find a section where you can customize the behavior for uploading player headshots. Here's a step-by-step guide on how to configure it:

  1. Set the Target Distance: You can adjust the distance at which players can target the location for uploading headshots. The default value is 2.0, but you can increase or decrease it based on your preference. Keep in mind that it should be a float, so use 2.0 instead of just 2.

  2. Define Allowed Jobs and Grades: Determine which jobs and grades should have access to upload player headshots. It's recommended to include a whitelisted job like "police" to prevent abuse by unauthorized players who might attempt to change others' headshots using their citizenid number.

  3. Configure the Upload Target: In the UploadURLs section, you'll need to specify the target location using vector3 coordinates, minZ, maxZ, heading, width, and height. The minZ value should be slightly lower than the "z" coordinate of the vector3, while the maxZ should be slightly higher. This ensures that the target area encompasses the desired location for uploading headshots.

By following these instructions, you can tailor the headshot uploading system to your specific preferences and needs.

    --[[ TARGET & INPUT SETTINGS ]]
    TargetDistance = 2.0, -- Distance to target for URL input.

    Jobs = {["police"] = 0, ["usms"] = 0, }, -- Configure Your Job's and Grade's that are able to Target the Input Area. 
    -- For ox_target Edit above to use a single job only, no grade! Example: Jobs = "police",

    Icon = "fas fa-id-card", -- Target Icon
    Label = "Headshot URL",    
    UploadURLs = { -- Coordinates to Target for Uploading URL's.
        coords = vector3(448.0596, -978.642, 30.8153), 
        minZ = 30.7, 
        maxZ = 31.1, 
        heading = 179.66, 
        w = 0.5, -- adjust this for the size of the sphere if using ox_target.
        h = 0.15, 
    },

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:

  1. Add Jobs: Include the names of the jobs for which you want to enable the usage of badges. For example, you can add "police," "medic," "firefighter," or any other job you have in your server.

  2. Set Logo URLs: For each job you added, 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.

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.

    --[[ EMPLOYMENT BADGE SETTINGS ]]
    Badges = { -- Enter the job name and URL for the badge logo image.

        -- Only the Jobs you list below have authorization to use a badge.
        ["default"] =    { url = "https://i.imgur.com/kUgqqzf.png", }, -- DO NOT REMOVE: Job logo to Display on ID Card if Job Not listed Below. (Los Santos Seal)
        ["unemployed"] = { url = "https://i.imgur.com/qqk0bFQ.png", }, 
        ["police"] =     { url = "https://i.imgur.com/GlVEUqX.png", },
        ["ambulance"] =  { url = "https://i.imgur.com/utpZdS2.png", },
        ["catcafe"] =    { url = "https://i.imgur.com/ttLyyZM.png", },
        ["usms"] =       { url = "https://i.imgur.com/f7OIdPK.png", },

        -- Add More Jobs, and Logo URLs. Follow the format below.
        --["jobname"] = { url = "https://example_logo_url_here.png", },
    },

Step 7 - Locales & CloseInv

In the final sections of the config file, you will find the Locales section, which you can customize to use your preferred language in the script's notifications and messages. You can change the text to fit the language and style of your server.

Additionally, there is a function provided to close the player's inventory if they use the badge or ID from within the inventory instead of a hot slot. By default, the command setup is designed for qb-inventory, but you can easily modify it to work with the inventory system used on your server's client-side. This ensures that the player's inventory is properly closed after using the badge or ID item.

To summarize, the final sections of the config file allow you to customize the script's language and notifications to match your server's preferences, and it provides a flexible way to close the player's inventory when using the badge or ID item. You can make adjustments based on your inventory system to ensure smooth functionality in-game.

Locales = {
    Notify = { 
        ["not_authorized"] = "You are not authorized to use this badge!",
        ["url_uploaded"] = "Headshot URL updated for Citizen ID: ",
        ["upload_failed"] = "Failed to update Headshot URL for Citizen ID: ",
    },
    Input = {
        ["input_header"] = "Headshot URL Upload",
        ["citizen_id"] = "Citizen ID #:",
        ["photo_url"] = "Image URL:",
        ["incomplete"] = "You must fill in both boxes!",        
    },
}

-- Add your close inventory event/export/command when player uses ID or Badge directly from inventory instead of hotkey.
-- Can be a server-side or client-side event.
function CloseInv(ped)
    return ExecuteCommand('closeinv') -- used with updated qb-inventory/qs-inventory.
end

Last updated