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
| Parameter | Type | Required | Description |
|---|---|---|---|
serial | string | Yes | The unique serial number of the firearm. |
imageurl | string or nil | No | Direct URL path to an image of the weapon. |
owner_cid | string | Yes | The Citizen ID / State ID of the registered owner. |
label | string or nil | No | The display label or model name of the weapon (e.g., Combat Pistol). Defaults to Unknown Weapon if omitted. |
model | string or nil | No | The 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:trueif the weapon was successfully registered or already exists in the database,falseotherwise.
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