Exports

Server

exports.lvs_idmanager:create

Syntax

exports.lvs_idmanager:create(playerId, typeId, extra)

Parameters

  • playerId (number): The player's server ID.

  • typeId (string): One of the types defined in Config.CardType (located in config.lua).

  • extra (table | nil): Optional parameter used when typeId is 'driver'. It should contain the key class, indicating the driver's license class.

Return Value

  • If typeId does not exist in Config.CardType, the function returns nil.

  • On success, the function grants the player an item with the following metadata:

        type = 'identification'
        id_number 
        id_type
        id_cid
        id_dob
        id_firstname
        id_lastname
        id_sex
        id_nationality
        id_photo
        id_job? -- Only on jobs id's
        id_occupation? -- Only on jobs id's
        id_class? -- Only if typeId is 'driver'

Example Usage

-- Create a Citizen ID for a player
exports.lvs_idmanager:create(1, "citizen")

-- Create a driver's license with a specific class
exports.lvs_idmanager:create(1, "driver", { class = "Class B" })

Notes

  • If typeId is not defined in Config.CardType, the function returns nil and does not execute any actions.

  • If typeId is 'driver', it is recommended to always provide a valid extra.class.

  • Best Practice: Before granting the item, it is advisable to check whether the player can carry it to avoid inventory issues.


exports.lvs_idmanager:createFake

Syntax

exports.lvs_idmanager:createFake(playerId, typeId, data)

Parameters

  • playerId (number): The player's server ID.

  • typeId (string): One of the types defined in Config.CardType (located in config.lua).

  • data (table): A table containing the following information:

        dob
        firstname
        lastname
        sex
        nationality
        class? -- Only if typeId is 'driver'

Return Value

  • If typeId does not exist in Config.CardType, the function returns nil.

  • On success, the function grants the player an item with the same metadata structure as create.

Example Usage

-- Create a fake Citizen ID
exports.lvs_idmanager:createFake(1, "citizen", {
    dob = "1990-01-01",
    firstname = "John",
    lastname = "Doe",
    sex = "M",
    nationality = "USA"
})

-- Create a fake driver's license with a specific class
exports.lvs_idmanager:createFake(1, "driver", {
    dob = "1992-05-10",
    firstname = "Jane",
    lastname = "Smith",
    sex = "F",
    nationality = "Canada",
    class = "Class A"
})

Notes

  • If typeId is not defined in Config.CardType, the function returns nil and does not execute any actions.

  • If typeId is 'driver', it is recommended to always provide a valid extra.class.

  • Best Practice: Before granting the item, it is advisable to check whether the player can carry it to avoid inventory issues.


exports.lvs_idmanager:isFake

Syntax

exports.lvs_idmanager:isFake(metadata)

Parameters

  • metadata (table): ID Item metadata to check.

Return Value

  • Returns true if the document type is illegal (fake), otherwise false.

Example Usage

-- some metadata example from a ID item
local metadata = {
    type = 'identification',
    id_type = 'citizen_fake',
    id_number = '9999999',
    id_cid = 'AAAAAAA',
    ...
}

if exports.lvs_idmanager:isFake(metadata) then
    print("This is an illegal document!")
end

exports.lvs_idmanager:isOwner

Syntax

exports.lvs_idmanager:isOwner(playerId, metadata)

Parameters

  • playerId (number): The player's server ID.

  • metadata (table): The data of the identification item metadata.

Return Value

  • Returns true if the identification belongs to the specified playerId, otherwise false.

Example Usage

local metadata = {
    type = 'identificaction',
    id_type = 'citizen',
    id_number = 'UFR1245',
    id_cid = 'UFR1245',
    ...
}

if exports.lvs_idmanager:isOwner(1, metadata) then
    print("The player is the owner of this ID.")
end

Last updated