The nicks are on the channel, right? This will only work for nicks who are currently in the channel.
Other than that, can you insert this line:
echo -a ban $1 %bans
Before the ban $1 %bans line? Then we can see where the problem is. I didn't want to ban people in my channel, so I just used echo instead and it seems to work fine. Let me know what you get for an echo.