Skip to content

GetPlayerWeapon

The weapon the damage model charges the player’s hits to.

The table name of the melee weapon the player has equipped and drawn (shortswordBroad, longSwordDuel …), as the weapon argument of OnPlayerDamage names it; "" bare-handed, with the weapon sheathed, or without the tables export. GetItemInfo turns the name into its catalogue entry.

GetPlayerWeapon(pid)
Parameter Type
pid number the player

string - the weapon’s name; "" when none

local weapon = GetPlayerWeapon(pid)
if weapon ~= "" then
local info = GetItemInfo(weapon)
SendClientMessage(pid, COLOUR_SERVER, "you fight with " .. (info and info.display ~= "" and info.display or weapon))
end

GetPlayerEquipment · GetItemInfo · OnPlayerDamage · the Combat group of the index