Posting a huge code and saying "fix it because I don't know why it's not working" won't help. No one is going to debug things for you. Start adding debug messages in Takedamage, see how the variables are filled and where code fails(after which if() statement, etc, you get the ideea).
3.There is a tutorial in code snippets section I think.