When all else fails, insert some debug lines into your script so you can see what it's doing. In between these 2 lines
on 1:notice:*:#: {
if ( $nick == ChanServ ) { goto end }
insert this line
echo -s $nopath($script) $scriptline target $target chan $chan nick $nick address $address wildsite $wildsite shutupip %shutupip line (1) $1 (2) $2 (3) $3 (4-) $4-
You'll see that, in the /notice generated by the invite, $nick is not filled by the nick being invited, but $nick and $address are both filled by the name of the server that the invited nick is on, and $wildsite is blank. I suspect your script is not filling %shutupip elsewhere, so when your script checks if (%shutipip == $wildsite), they're both $null, so they match, but this $null value in the ban command because the missing/insufficient parameter.
If you want to identify the difference between this notice and a notice faked by someone, you can use the results of that /notice to identify things that won't be that way with other notices:
1. $address == $nick instead of being an actual nick.
2. $wildsite is $null
3. $target == @ $+ $chan
4. $2 $4- == invited into the channel.
Unless you have a list of server names or they are all guaranteed to be a certain pattern such as containing the $network name, you can't verify that $nick is really the servername on which the invited nick resides.
Instead of banning $nick you should ban $3, and if the banned nick isn't in the channel you'll get an error message from the server telling you so, so instead of banning $wildsite you should ban $3 $+ !*@*
Your kick command should first check of the nick is even on channel yet before trying to kick them. Also, you have the script try to ban someone as many as FOUR times, depending on how many of those variables are set. Instead of..
if ( %shutupip3 == $wildsite ) do stuff
if ( %shutupip2 == $wildsite ) do stuff
do..
if ( %shutupip3 == $3 ) do stuff
elseif ( %shutupip2 == $3 ) do stuff
and since you need to make sure someone is in channel before kicking them..
.kick $chan $nick $nick %oz.oz.shutup1
becomes
if ($3 ison $chan) kick $chan $3 $3 %oz.oz.shutup1