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.

How would i go about doing this?

Old posts that have not been replied to for several years.
Locked
T
Trucido

How would i go about doing this?

Post by Trucido »

I want to setup a chan where i can have a eggdrop running...where i can say !add <nick> and it add the nick's host to a userbase...and when someone joins the channel if the person joining isnt on the userbase then there either kicked or banned.

HOw would i do this??

Trucido
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

The problem is eggdrop doesn't know the nick's user@host unless they're in a channel together. Since this script kicks anybody who isn't a valid user, they won't ever be in a channel together long enough for you to type !add <nick>. The solution is to have the script send a /whois <nick> and catch the user@host from that reply. That's too much work for me right now, as I'm feeling rather lazy. So here is a script that lets you say !add nick!user@host instead. It only works for global owners, but you can change the flags in the bind command ("n") to be whatever you want.

I didn't test this at all so I don't even know if it will load. But I present to you, sheepkick:

Code: Select all

if {![info exists sheepkick_loaded]} {
  set sheepkick_loaded baa
  bind pub n !add add_sheep
  bind join - * join_sheep
}
proc add_sheep {nick uhost hand chan text} {
  set newhand [lindex [split $text !] 0]
  if {[validuser $newhand]} {
    chattr $newhand +E
    setuser $newhand HOSTS [maskhost $text]
    putserv "privmsg $chan :User '$newhand' already exists -- adding [maskhost $text]"
    return 0
  }
  if {[catch {adduser $newhand [maskhost $text]}]} {
    putserv "privmsg $chan :Error adding $newhand ($text) -- aborting"
    return 0
  }
  chattr $newhand +E
  return 0
}
proc join_sheep {nick uhost hand chan} {
  if {![validuser $hand] || ![matchattr $hand E]} {
    putkick $chan $nick "Invalid user -- baa"
  }
  return 0
}
putlog "Loaded: sheepkick by stdragon"
Locked