Kartik Scripts

Create Weapon Info

Registers a new weapon directly in the MDT database. This is commonly used in shop/purchase scripts, armory resource integrations, or inventory weapon registration events.

Export Syntax

exports['kartik-mdt']:CreateWeaponInfo(serial, imageurl, owner_cid, label, model)

Parameters

ParameterTypeRequiredDescription
serialstringYesThe unique serial number of the firearm.
imageurlstring or nilNoDirect URL path to an image of the weapon.
owner_cidstringYesThe Citizen ID / State ID of the registered owner.
labelstring or nilNoThe display label or model name of the weapon (e.g., Combat Pistol). Defaults to Unknown Weapon if omitted.
modelstring or nilNoThe weapon item or model name (e.g., WEAPON_COMBATPISTOL), shown as the weapon's Classification in the MDT. Defaults to label if omitted.

Return Value

  • Returns boolean: true if the weapon was successfully registered or already exists in the database, false otherwise.

Example Usage

local serial = "W-123456789"
local imageUrl = "https://example.com/images/pistol.png"
local ownerCid = "CID00123"
local label = "Combat Pistol"
local model = "WEAPON_COMBATPISTOL"

local success = exports['kartik-mdt']:CreateWeaponInfo(serial, imageUrl, ownerCid, label, model)
if success then
    print("^2[MDT Integration]^7 Weapon successfully registered!")
else
    print("^1[MDT Integration]^7 Failed to register weapon.")
end

On this page