mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2023
Posts: 2
J
JuanJo Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
J
Joined: Mar 2023
Posts: 2
Hello everyone, I have this code that works correctly, except for a small error, it bans nicks that are not on the blacklist, I would need a little help, because I can't find the solution despite many attempts. The code is originally Spanish, but I have translated it into English for this Forum.
Code
on *:TEXT:*:#: {
  if ($strip($1) == !blist) {
    if ($strip($2) == $null) {
      msg $chan 4Syntax Error: 12 $+ $strip($nick) $+  10Please use: 12!blist <add/del/list/info>
      halt
    }
    if ($strip($2) == add) {
      if ($strip($3) == $null) {
        msg $chan 4Syntax Error: 12 $+ $strip($nick) $+  10Please use: 12!blist ADD <nick>
        halt
      }
      if ($hget(Blacklist,$chan,$strip($3))) {
        msg $chan 4The nick 12 $+ $strip($3) $+  4is already registered on the blacklist for this channel.
        halt
      }
      hadd Blacklist $chan $strip($3) 1
      msg $chan 2The nick 12 $+ $strip($3) $+  2has been: 3Registered successfully for this channel.
      kickban $strip($chan) $strip($3)  4Sorry, you cannot remain in this channel.
      halt
    }
    elseif ($strip($2) == del) {
      if ($strip($3) == $null) {
        msg $chan 4Syntax Error: 12 $+ $strip($nick) $+   10Please use: 12!blist DEL <nick>
        halt
      }
      if (!$hget(Blacklist,$chan,$strip($3))) {
        msg $chan 4The nick 12 $+ $strip($3) $+  4is not registered on the blacklist for this channel.
        halt
      }
      hdel Blacklist $chan $strip($3)
      msg $chan 2The nick 12 $+ $strip($3) $+  2has been: 4Successfully removed from this channel's blacklist.
      halt
    }
    elseif ($strip($2) == list) {
      var %list = $hget(Blacklist,$chan,*)
      if (%list) {
        msg $chan 2Displaying List of Nicks for this channel.
        var %nick
        while ($hfind(Blacklist,$chan,%nick)) {
          msg $chan 2• 12 $+ %nick $+ 
          hinc %nick
        }
        msg $chan 2End of Nicks List for this channel.
        halt
      }
      else {
        msg $chan 2There are no registered nicks in the blacklist for this channel.
        halt
      }
    }
    elseif ($strip($2) == info) {
      if ($strip($3) == $null) {
        msg $chan 4Syntax Error: 12 $+ $strip($nick) $+   10Please use: 12!blist INFO <nick>
        halt
      }
      if (!$hget(Blacklist,$chan,$strip($3))) {
        msg $chan 4The nick: 12 $+ $strip($3) $+   4is not registered on the blacklist for this channel.
        halt
      }
      msg $chan 2Nick Information: 12 $+ $strip($3)
      timer 1 1 msg $chan 2Status: 3ACTIVE
      timer 1 2 msg $chan 2Date: 12 $+ $date
      timer 1 3 msg $chan 2Time: 12 $+ $time
      timer 1 4 msg $chan 2Registered by: 12 $+ $strip($nick)
      timer 1 5 msg $chan 2End of Information.
      halt
    }
  }
}

on *:JOIN:#: {
  if ($istok(%nicks,$nick,32)) {
    halt
  }
  if ($hget(Blacklist,$chan,$nick)) {
    mode $chan +b $address($nick,2)
    kick $chan $nick 4Sorry, you cannot remain in this channel.
  }
}

on *:NICK: {
  if ($istok(%nicks,$newnick,32)) {
    halt
  }
  if ($hget(Blacklist,$chan,$newnick)) {
    mode $chan +b $address($newnick,2)
    kick $chan $newnick 4Sorry, you cannot remain in this channel.
  }
}

on *:START: {
  hmake Blacklist 10000
  hload -n Blacklist.hsh Blacklist
  set %nicks nick1 nick2 ...
}

on *:EXIT: {
  hsave -n Blacklist.hsh Blacklist
}

alias kickban {
  set %kbchan $strip($1) 
  set %kbnick $strip($2) 
  set %kbreason $3-
  mode %kbchan +b $address(%kbnick,2)
  kick %kbchan %kbnick %kbreason
  unset %kbnick
  unset %kbreason
  unset %kbchan
}

Joined: Jul 2006
Posts: 4,156
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,156
Hello

Quote
Hello everyone, I have this code that works correctly, except
Your code does not work correctly, at all. It can't possibly work correctly because it uses a misconception of hash table.
Hash tables are being misunderstood by whoever wrote this script, the whole script needs to be rewritten I'm afraid.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel

Link Copied to Clipboard