@Epic, I tried your script. I tried it both split (I prefer it, because I already have three different places set up where these commands are) and loading it whole, and it gives me the same problem for all three codes, whether trying them individually or all at once.
That is, the nickname that gets banned isn't the one of the account they're logged into, but the nickname they're currently using.
For example: if I'm logged in with the nickname TheKing, but I'm using the nickname BestGuest, those commands result in a ban on BestGuest, while the ban should actually be on TheKing.