source is not defined in client side 
function DamageToPed(attacker, weapon, bodypart, loss) 
    if weapon and attacker and attacker ~= getLocalPlayer() then 
        if weapon == 49 then --Rammed 
            outputChatBox("Rammed") 
        end 
        if bodypart == 9 then --HeadShot 
            setElementHealth(getLocalPlayer(), 0) 
        end 
     cancelEvent() 
    end 
end 
addEventHandler("onClientPedDamage", getRootElement(), DamageToPed)