egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Bot request script!

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive
View previous topic :: View next topic  
Author Message
metroid
Owner


Joined: 16 Jun 2004
Posts: 771

PostPosted: Fri May 13, 2005 1:50 am    Post subject: Reply with quote

Here is the script i was talking about, I have NO idea if it even works but try it out.

Code:
# Configuration

# homechannel where they can request
set setting(home) "#v1per"
# users the channel needs atleast
set setting(needed) "20"
# deny request if there is no Q or L?
set setting(service) "1"
# the flags he wants
set setting(flags) "+ao"

# end of config

# don't touch this setting!
set setting(busy) 0

bind pub -|- !request    request:pub

proc request:pub {nick host hand chan arg} {
  global setting
  # ignore the request because it isn't the request channel
  if {![string equal $chan $setting(home)]} {
   return 0
  }
  if {$setting(busy)} {
   putquick "NOTICE $nick :There is currently already an request in progress."
   return 0
  }
  set channel [lindex [split $arg] 0]
  # tell him he needs to input a channel first
  if {$channel == ""} {
   putquick "NOTICE $nick :Please state the channel you wish to request for."
   return 0
  }
  if {[validchan $channel]} {
   return 0;
  }
  # activate the busy signal so no other requests can be done
  bind RAW -|- 315         request:endofwho
  set setting(busy) 1
  set setting(chan) "$channel"
  set setting(nick) "$nick"
  channel add $channel
}
 
proc request:endofwho {from key arg} {
   global setting
   if {$setting(busy)} {
    if {![onchan $setting(nick) $setting(chan)] || ![isop $setting(nick) $setting(chan)]} {
     set setting(busy) 0
     putquick "NOTICE $setting(nick) :You aren't on $setting(chan) or you're not opped. Request denied."
     channel remove $setting(chan)
     unbind RAW -|- 315         request:endofwho
     return 0
    }
   if {$setting(service)} {
    if {![onchan L $setting(chan)] && ![onchan Q $setting(chan)]} {
     set setting(busy) 0
     putquick "NOTICE $setting(nick) :Q or L was not found on $setting(chan). Request denied."
     channel remove $setting(chan)
     unbind RAW -|- 315         request:endofwho
     return 0
    }
   }
   if {[llength [chanlist $setting(chan)]] < $setting(needed)} {
     set setting(busy) 0
     putquick "NOTICE $setting(nick) :$setting(chan) has less than $setting(needed) users. Request denied."
     channel remove $setting(chan)
     unbind RAW -|- 315         request:endofwho
     return 0
   }
 if {![validuser [nick2hand $setting(nick)]]} {
  adduser $setting(nick) *!*@[lindex [split [getchanhost $setting(nick) $setting(chan)] @] 1]
 }
  chattr [nick2hand $setting(nick)] |+n $setting(chan)
  putquick "NOTICE $setting(nick) :The request was succesfull. I will stay here. Please give me $setting(flags) on [request:service $setting(chan)]"
  putquick "PRIVMSG $setting(home) :$setting(nick) requested me for $setting(chan). The channel has [llength [chanlist $setting(chan)]] users. And they have the service bot: [request:service $setting(chan)]. Request was accepted."
  unset setting(chan); unset setting(nick)
  set setting(busy) 0
  unbind RAW -|- 315         request:endofwho
  return 1
  }
}

proc request:service {channel} {
  if {[onchan L $channel]} {
    return "L"
  } elseif {[onchan Q $channel]} {
    return "Q"
  }
}


If you need help with it, my nickname on Quakenet is metroid and you can find me in #v1per or #development
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    egghelp.org community Forum Index -> Archive All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber