Skip to content

HurtEvent issue with returning Weapon #149

@Mythikos

Description

@Mythikos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions