The LGF Document System is a custom document management system designed for FiveM. It allows players to manage, issue, and view various types of licenses, such as ID cards, driving licenses, weapon licenses, and boat licenses. This system integrates with ox_inventory and provides job-specific access to certain documents.
- Multiple Document Types: Supports various licenses, including:
- ID Cards
- Driving Licenses
- Weapon Licenses
- Boat Licenses
- Job Restrictions: Certain documents are only accessible for creation by specific jobs (e.g., only police can create weapon licenses).
- Dynamic Zones: Create specific zones on the map where players can interact with NPCs to view or manage documents.
- Customizable: Easily add more document types and configure their settings. You can create custom documents by following the structure of existing types in
Config.lua. - Job-Specific Context: There is a dedicated context for jobs that are allowed to create documents for other players.
ox_inventoryscreenshot-basicorMugShotBase64
ESXQBOXLegacyCoreox_core
-
Clone the Resource
Add this resource to yourresourcesdirectory in your FiveM server. -
Add Items to ox_inventory
To add the documents as items that can be managed by players, modify theitems.luafile in theox_inventory/data/items.luadirectory as follows:return { ['license_id'] = { label = 'ID Card', weight = 100, consume = 0, description = 'Your Personal Document', client = { export = 'LGF_DocumentSystem.manageDocument' } }, ['license_car'] = { label = 'Drive Card', weight = 150, consume = 0, description = 'Your Driving License', client = { export = 'LGF_DocumentSystem.manageDocument' } }, ['license_weapon'] = { label = 'Weapon License', weight = 200, consume = 0, description = 'License to Carry Weapons', client = { export = 'LGF_DocumentSystem.manageDocument' } }, ['license_boat'] = { label = 'License Boat', weight = 120, consume = 0, description = 'License to Operate Boats', client = { export = 'LGF_DocumentSystem.manageDocument' } }, }
-
Configure Documents and Zone in
Config.luaAdd your document types in the Config.lua file. -
Add your Language
server.cfgEnsure Language Files are Present: Make sure you have the necessary localization files. You should have a file named %s.json in the locales directory of your LGF_DocumentSystem.
setr LGF_DocumentSystem:GetLocales "it"- Returns all ID cards saved in the
id_card.jsonfile.
---@param any
---@return Table
exports.LGF_DocumentSystem:GetAllCards()- Creates a document for a player by
document type. The docType must match the existing types in theconfiguration, andplayerIdrefers to the target player's ID.
---@param docType string
---@param playerId number
---@return boolean | string
exports.LGF_DocumentSystem:CreateDocument(docType, playerId)lib.addCommand('createdocument', {
help = 'Creates a document for a specified player',
params = {
{
name = 'playerId',
type = 'playerId',
help = 'Target player\'s server ID',
},
{
name = 'docType',
type = 'string',
help = 'Type of document to create (must match existing types)',
},
},
restricted = 'group.admin'
}, function(source, args, raw)
local playerId = args.playerId
local docType = args.docType
local success, result = exports.LGF_DocumentSystem:CreateDocument(docType, playerId)
if success then
print(("Document of type '%s' created for player ID %d successfully!"):format( docType, playerId))
else
print(("Failed to create document for player ID %d: %s"):format(playerId, result))
end
end)
- Check the player inventory to see if she already has that
type of license.
---@param docType string
---@return boolean
exports.LGF_DocumentSystem:HasDocumentOfType(docType)- Check the
stateof the UI, return true if is opened otherwise false.
---@return boolean
exports.LGF_DocumentSystem:GetStateDocumentUI()- Open documents by passing
parameters as you like, Useful for creating fake documents etc. - Note, You have to create the logic
yourselffor this to be able to show the documents to others etc
---@param state boolean
---@param data string[]
exports.LGF_DocumentSystem:OpenDocument(state,data)| Key | Type | Description |
|---|---|---|
| Name | string | The first name of the individual. |
| Surname | string | The last name of the individual. |
| Sex | string | The gender of the individual (e.g., "Male", "Female"). |
| Dob | string | The date of birth in the format "DD/MM/YYYY". |
| Avatar | string | The Base64 or a url image representation of the individual's avatar image. |
| IdCard | string | A unique identifier for the document (e.g., "#A0A0A0"). |
| Expiration | string | The expiration date of the document in the format "DD/MM/YYYY". |
| TypeDocs | string | The type of document (e.g., "license_id"), require matching whit existing. |
| Released | string | The release date of the document in the format "DD/MM/YYYY HH:MM". |
local keybind = lib.addKeybind({
name = 'dwadwada',
description = 'press k To Toggle Document',
defaultKey = 'K',
onPressed = function(self)
-- Check if the Document is already opened
local isOpened = exports.LGF_DocumentSystem:GetStateDocumentUI()
if isOpened then
-- If is opened close the document
exports.LGF_DocumentSystem:OpenDocument(false, {})
else
-- Retrieve the mugshot whit MugShotBase64 and use it
local Mugshot = exports["MugShotBase64"]:GetMugShotBase64(cache.ped, true)
exports.LGF_DocumentSystem:OpenDocument(true, {
Name = "Entino",
Surname = "Calogero",
Sex = "Male",
Dob = "02/12/1998",
Avatar = Mugshot,
IdCard = ("#%s"):format(lib.string.random("A0A0A0", 6)),
Expiration = "02/01/2026",
TypeDocs = "license_id",
Released = "25/09/2021 21:06",
})
end
end,
})