It's not possible to ever reach the elseif statement in either one because in the event headers, you have !setevent or !setrules as the trigger words (which also happens to be $1), and then in the elseif you check if $1 is !event or !rules, which is obviously not possible in this case. You need to either change the trigger word to be more general or just make a separate event for !rules and !event.