This kicks/warns on 3, ban/kicks on 4. The var may unset if they don't have auto-rejoin enabled.
Looks to me as though %spam is any text at all, sent too quickly ( 3 or 4 lines in under 3 seconds )
Code:
on *:TEXT:*:#:{
  inc -u3 %spam. [ $+ [ $nick ] ]
  if (%spam. [ $+ [ $nick ] ] == 4) {
    ban $chan $address($nick,1)
    kick $chan $nick Spam
  }
}

on *:TEXT:*:#:{
  inc -u3 %spam. [ $+ [ $nick ] ]
  if (%spam. [ $+ [ $nick ] ] == 3) {
    kick $chan $nick Do Not Spam. You have been warned.
  }
  if (%spam. [ $+ [ $nick ] ] == 4) {
    ban -k $chan $address($nick,1) Spamming. You were warned.
  }
}

This will tell user if they are ineligible, or if they use the wrong syntax.
Code:
on *:text:!mute *:#:{
  if ($nick isop $chan) || ($nick ishop $chan) {
    if ( !$2 ) { notice $nick You must specify a nick. | return }
    mode $chan +bb ~q: $+ $address($2,2)
    mode $chan -v $2 
    notice $nick $2 has been muted 
  }
  else notice $nick You must have op/hop status to use this command.
}
on *:text:!unmute *:#:{
  if ($nick isop $chan) || ($nick ishop $chan) {
    if ( !$2 ) { notice $nick You must specify a nick. | return }
    mode $chan -b ~q: $+ $address($2,2)
    msg $chan $2 has been unmuted 
    mode $chan +v $2 
  }
  else notice $nick You must have op/hop status to use this command.
}

For second request, need to know if the script is loaded in the bot client.


LonDart