CreateWeapon


Register a weapon

---@param serial string Serial of the weapon
---@param owner {source?: number, stateid?: string} Owner of the weapon (either a player server id or a stateid)
---@param model string Model name of the weapon (eg; weapon_assaultrifle)
---@param label string Name of the weapon (eg; AK 47)
exports.drx_mdt:CreateWeapon()

Example using source

local function createWeaponBySource(source)
  local serial = '123456789'
  local model = 'weapon_assaultrifle'
  local label = 'AK 47'

  exports.drx_mdt:CreateWeapon(serial, { source = source }, model, label)
end

Example using stateid

local function createWeaponByStateid(source)
  local stateid = exports.drx_mdt:GetStateId({ source = source })

  local serial = '123456789'
  local model = 'weapon_assaultrifle'
  local label = 'AK 47'

  exports.drx_mdt:CreateWeapon(serial, { stateid = stateid }, model, label)
end

Last updated