You also forgot that if a player has 0 hp he is dead too..
if (%p2hp < 0) { should be like this if (%p2hp <= 0) {
You should add ags or bgs too :) I think many people would like to use that