It appears that the HurtEvent as used with hook On_CorpseHurt does not return the weapon in the instance of a melee weapon.
Rifles/Bows return a valid weapon entity
Hatchets/Pickaxes/Other Melee weapons return null/nil
My Code:
function On_CorpseHurt(HurtEvent)
local ply = HurtEvent.Attacker
local weapon = HurtEvent.Weapon
if weapon == nil then
weapon = {}
weapon.Name = "unknown weapon"
end
local dType = HurtEvent.DamageType
if ply.IsPlayer() then
Server.Broadcast(ply.Name.." hit a corpse using a(n) "..weapon.Name.." (Damage Type: "..tostring(dType)..")!")
end
end
The output:
http://www.mythicservers.com/images/mythic/2015-11-05_19-00-10.png
1st was bolt action
2nd was stone hatchet
3rd was stone pickaxe
It appears that the HurtEvent as used with hook On_CorpseHurt does not return the weapon in the instance of a melee weapon.
Rifles/Bows return a valid weapon entity
Hatchets/Pickaxes/Other Melee weapons return null/nil
My Code:
The output:
http://www.mythicservers.com/images/mythic/2015-11-05_19-00-10.png
1st was bolt action
2nd was stone hatchet
3rd was stone pickaxe