Exports
Server
exports.lvs_idmanager:create
exports.lvs_idmanager:createSyntax
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 inconfig.lua).extra (table | nil): Optional parameter used when
typeIdis'driver'. It should contain the keyclass, indicating the driver's license class.
Return Value
If
typeIddoes not exist inConfig.CardType, the function returnsnil.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
typeIdis not defined inConfig.CardType, the function returnsniland does not execute any actions.If
typeIdis'driver', it is recommended to always provide a validextra.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
exports.lvs_idmanager:createFakeSyntax
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 inconfig.lua).data (table): A table containing the following information:
dob firstname lastname sex nationality class? -- Only if typeId is 'driver'
Return Value
If
typeIddoes not exist inConfig.CardType, the function returnsnil.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
typeIdis not defined inConfig.CardType, the function returnsniland does not execute any actions.If
typeIdis'driver', it is recommended to always provide a validextra.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
exports.lvs_idmanager:isFakeSyntax
exports.lvs_idmanager:isFake(metadata)Parameters
metadata (table): ID Item metadata to check.
Return Value
Returns
trueif the document type is illegal (fake), otherwisefalse.
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!")
endexports.lvs_idmanager:isOwner
exports.lvs_idmanager:isOwnerSyntax
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
trueif the identification belongs to the specifiedplayerId, otherwisefalse.
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.")
endLast updated