You don't have matching pair of curly braces, so it swallows the rest of the script in its search for a match. Sometimes the imbalance is caused by one of the braces touching another character which changes its meaning, but here you literally have 5 open curly braces and only 4 closing.

It also looks like you're missing some code, because it doesn't make sense to have the 'set' line in between the "if (%floodcommand) { return }" and the "else". Also, the $true condition ends with a 'return', so there doesn't need to be an "else" on the line below it.