Just because you have the correct amount of brackets overall, doesn't mean that your brackets are correct. All mirc does is count them.
on *:INVITE:*: { if (!%flood.protect) {
.timer.invite 1 1 invited
set %invite.chan $chan
set %invite.nick $nick
set -u5 %flood.protect
}
Where is the second closing bracket in this event ?
This event is not closed until the end of the invited alias, putting the invited alias inside of the on invite event.
No way this work correctly ;/