Code:
function player_ondamage( player, damageInfo )
-- Entity that is attacking
local attacker = damageInfo:GetAttacker()
-- If no attacker do nothing
if not attacker then return end
-- If attacker is a player do nothing
if not IsPlayer(attacker) then return end
local playerAttacker = CastToPlayer(attacker)
-- If player is damaging self do nothing
if player:GetId() == playerAttacker:GetId() then return end
end