This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Protecting user\bot

Old posts that have not been replied to for several years.
Locked
3
3zzy
Halfop
Posts: 42
Joined: Sun Sep 14, 2003 6:58 am

Protecting user\bot

Post by 3zzy »

OK, I need two scripts here. First one should kick a user if he kicked a bot on the first time, the next time the bot will be kicked, it shound ban the abuser of the bot.

The second one is similr, but with users. If someone kicks a protected user, the bot should kick the abuser, and on the second time, ban him.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

bind mode - "* +b" protect:ban
bind kick - "*" protect:kick
bind mode - "* -o" protect:deop

proc protect:ban {nick uhost hand chan mc ban} {
  if {![botisop $chan]} {
    return
  }
  if {[matchattr $hand mn|mn $chan]} {
    return
  }
  foreach luser [chanlist $chan mn|nm] {
    if {[string match -nocase $ban $luser![getchanhost $luser $chan]] || [string match -nocase $ban "$::botname"]} {
      scan $uhost "%\[^@\]@%s" user host
      putquick "MODE $chan -bo+b $ban $nick *!*@$host" -next
      newchanban $chan *!*@$host Moron "Don't \002ban\002 me or one of my friends moron!" 1440
    }
  }
}

proc protect:kick {nick uhost hand chan vict reas} { 
  if {[matchattr $hand mn|mn $chan]} {
    return
  }
  if {$vict == $::botnick || [matchattr [nick2hand $vict $chan] mn|mn $chan]} {
    scan $uhost "%\[^@\]@%s" user host
    newchanban $chan *!*@$host Moron "Don't \002kick\002 me or one of my friends moron!" 1440
  }
}

proc protect:deop {nick uhost hand chan mc vict} {
  if {[matchattr $hand mn|mn $chan]} {
    return
  }
  if {[matchattr [nick2hand $vict $chan] mn|mn $chan] || $vict == $::botnick} {
    scan $uhost "%\[^@\]@%s" user host
    newchanban $chan *!*@$host Moron "Don't \002deop\002 me or one of my friends moron!" 1440
  }
}
there.. this might be your start! .. add arrays to make it *remember* if he had been banned/kicked/deoped before by the same user.
Once the game is over, the king and the pawn go back in the same box.
3
3zzy
Halfop
Posts: 42
Joined: Sun Sep 14, 2003 6:58 am

Post by 3zzy »

As i can see, it will also protect the user from getting banned. But how do i tell the bot to pretect some user? I don't want it to protect averyone, just a few of them.
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

with something like this:

Code: Select all

set doprotect "bla foo bar" 
if {[lsearch -exact [strlwr $doprotect] [strlwr $nick]]} {
# here it matches.. do your stuff.
}
Once the game is over, the king and the pawn go back in the same box.
3
3zzy
Halfop
Posts: 42
Joined: Sun Sep 14, 2003 6:58 am

Post by 3zzy »

Do I add this bit to the other one? and bla foo bar are the nicks to pretect?
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

That was an example, change it to suit your needs.
Once the game is over, the king and the pawn go back in the same box.
User avatar
GodOfSuicide
Master
Posts: 463
Joined: Mon Jun 17, 2002 8:00 pm
Location: Austria

Post by GodOfSuicide »

caesar wrote:That was an example, change it to suit your needs.
i would tend to add a custom flag for users to protect, it's better to edit that a string list
Locked