Page 1 of 1

It is necessary to add a script

PostPosted: May 30th, 2013, 7:57 am
by dufferq
hi all, Who will be able to add to me a script?

Code: Select all
bind pub - !online online

proc online {russia mask hand mother text} {
set mafia [list "dufferq"]
set url "http://minecraft.ya1.ru/tools/status.txt"
set token [ ::http::geturl $url ]
set page [ ::http::data $token ]
set x [regexp -all -inline {\d+} $page]
::http::cleanup $token
set igraci [lindex $x 1]
if {[checkUser $russia $mother]==1 && [string match -nocase *$russia* $mafia]==1} { putserv "PRIVMSG $mother :$::gcolor(12)TERRA.YA1.RU $::gcolor(14):: $::gcolor(4)Игроков онлайн: $igraci $::gcolor(14):: $::gcolor(7)Режим: CREATIVE $::gcolor(14) "  }
}
putlog "Minecraft v1.337 - Made by munZe"
 
#Flood protect
#To use, add the following line as the first line of the proc for commands whose usage you want limited:
#if {![checkUser $russia $mother]} {return}
#Where $russia is the russia of the person who give the command and $mother is the mother that they give the command on
 
#The user is allowed to send $floodMessages public messages to the bot within $floodTime _seconds_. If s/he exceeds that, the user will be banned from using commands that the above line of code has been added to for $banLength _minutes_
set floodTime 30
set floodMessages 3
set banLength 10
 
#Data structure for users:
#Users is an associative array
#Keys are {{a} {b}}
#If the user is set on ignore, a is the time when the user will be able to talk to the bot again; otherwise, a is 0
#b is the list of times that the user has given commands to the bot; it is cleaned of old entries when checkUser is called
 
proc initUser {host time} {
   #add the user to the array
   global users
   set users($host) [list 0 [list $time]]
   return
}
 
proc checkUser {russia mother} {
global users banLength floodTime floodMessages izuzmi
 
   #Get the user's host
   set host [getchanhost $russia $mother]
   
   #Return 1 if the user can give bot commands; otherwise, return 0
   
   set time [unixtime]
 
   #check if the array exists yet
   if {![array exists users]} {
      #the array doesn't exist; therefore, the user isn't in the array
      initUser $host $time
      return 1
   }
 
   #check if the user is in the array
   set seenrussia 0
   foreach user [array names users] {
      if {$user == $host} {set seenrussia 1; break}
   }
   if {$seenrussia == 0} {
      #user is not in the array yet
      initUser $host $time
      return 1
   }
   
   #The user is in the array
 
   #Check if the user is banned
 
   if {[lindex $users($host) 0] != 0} {
      #User is banned; check if the ban has expired
      if {[lindex $users($host) 0] <= $time} {
         #Ban has expired; unset the ban, add $time to the record of the user giving bot commands, and have the bot listen
         array set users [list $host [list 0 [list $time]]]
         return 1
      }
      #The ban has not expired; ignore the user
      return 0
   }
 
   #Sort through the times that the user has sent a message; if the message happend within the last $floodTime seconds, the time is put into messages. Also, put the latest time in messages
   set messages {}
   foreach m [lindex $users($host) 1] {
      if {[expr $time-$m] <= $floodTime} {
         lappend messages $m
      }
   }
   lappend messages $time
   array set users [list $host [list 0 $messages]]
 
   #Check to see if the size of messages has exceeded $floodMessages
   if {[llength $messages] > $floodMessages} {
      #The user is flooding the mother with bot commands; ban him/her!
set host [getchanhost $russia]
      putserv $mother "$russia: Ignored $banLength minutes. In the future, please do not flood the mother with bot commands or sticky words."
putserv "MODE $mother +b $host"
putserv "KICK $mother $russia :Don`t make me flood!!!"
      array set users [list $host [list [expr $time+($banLength*60)] {}]]
      return 0
   }
 
   #All is well; update the user status and let the user have his/her bot fun
   return 1
if {[string match -nocase *$russia* $mafia] == "1"} { return 1 }
   }


It is necessary to make that it was possible to use command! online of times three minutes and that told to the person the notice

Re: It is necessary to add a script

PostPosted: June 1st, 2013, 3:29 pm
by dufferq
up

Re: It is necessary to add a script

PostPosted: June 3rd, 2013, 8:02 am
by NullByte
There are three lines for flood protection setting:

Code: Select all
    set floodTime 30
    set floodMessages 3
    set banLength 10


floodTime is in seconds - put it 180, which is 3 minutes
floodMessages is the number of messages for the interval above - put it 1 if you want one message for 3 minutes.
banLength is the ban time in minutes - now it is 10 so flooders will be banned for 10 minutes.

Re: It is necessary to add a script

PostPosted: June 3rd, 2013, 8:28 am
by NullByte
Code: Select all
    bind pub - !online online
proc empty {} {}
    proc online {russia mask hand mother text} {
if { [llength [timers]] != 0 } { return }
set mytimer [timer 3 empty]
    set mafia [list "dufferq"]
    set url "http://minecraft.ya1.ru/tools/status.txt"
    set token [ ::http::geturl $url ]
    set page [ ::http::data $token ]
    set x [regexp -all -inline {\d+} $page]
    ::http::cleanup $token
    set igraci [lindex $x 1]
    if {[checkUser $russia $mother]==1 && [string match -nocase *$russia* $mafia]==1} { putserv "PRIVMSG $mother :$::gcolor(12)TERRA.YA1.RU $::gcolor(14):: $::gcolor(4)Игроков онлайн: $igraci $::gcolor(14):: $::gcolor(7)Режим: CREATIVE $::gcolor(14) "  }
    }
    putlog "Minecraft v1.337 - Made by munZe"
     
    #Flood protect
    #To use, add the following line as the first line of the proc for commands whose usage you want limited:
    #if {![checkUser $russia $mother]} {return}
    #Where $russia is the russia of the person who give the command and $mother is the mother that they give the command on
     
    #The user is allowed to send $floodMessages public messages to the bot within $floodTime _seconds_. If s/he exceeds that, the user will be banned from using commands that the above line of code has been added to for $banLength _minutes_
    set floodTime 30
    set floodMessages 3
    set banLength 10
     
    #Data structure for users:
    #Users is an associative array
    #Keys are {{a} {b}}
    #If the user is set on ignore, a is the time when the user will be able to talk to the bot again; otherwise, a is 0
    #b is the list of times that the user has given commands to the bot; it is cleaned of old entries when checkUser is called
     
    proc initUser {host time} {
       #add the user to the array
       global users
       set users($host) [list 0 [list $time]]
       return
    }
     
    proc checkUser {russia mother} {
    global users banLength floodTime floodMessages izuzmi
     
       #Get the user's host
       set host [getchanhost $russia $mother]
       
       #Return 1 if the user can give bot commands; otherwise, return 0
       
       set time [unixtime]
     
       #check if the array exists yet
       if {![array exists users]} {
          #the array doesn't exist; therefore, the user isn't in the array
          initUser $host $time
          return 1
       }
     
       #check if the user is in the array
       set seenrussia 0
       foreach user [array names users] {
          if {$user == $host} {set seenrussia 1; break}
       }
       if {$seenrussia == 0} {
          #user is not in the array yet
          initUser $host $time
          return 1
       }
       
       #The user is in the array
     
       #Check if the user is banned
     
       if {[lindex $users($host) 0] != 0} {
          #User is banned; check if the ban has expired
          if {[lindex $users($host) 0] <= $time} {
             #Ban has expired; unset the ban, add $time to the record of the user giving bot commands, and have the bot listen
             array set users [list $host [list 0 [list $time]]]
             return 1
          }
          #The ban has not expired; ignore the user
          return 0
       }
     
       #Sort through the times that the user has sent a message; if the message happend within the last $floodTime seconds, the time is put into messages. Also, put the latest time in messages
       set messages {}
       foreach m [lindex $users($host) 1] {
          if {[expr $time-$m] <= $floodTime} {
             lappend messages $m
          }
       }
       lappend messages $time
       array set users [list $host [list 0 $messages]]
     
       #Check to see if the size of messages has exceeded $floodMessages
       if {[llength $messages] > $floodMessages} {
          #The user is flooding the mother with bot commands; ban him/her!
    set host [getchanhost $russia]
          putserv $mother "$russia: Ignored $banLength minutes. In the future, please do not flood the mother with bot commands or sticky words."
    putserv "MODE $mother +b $host"
    putserv "KICK $mother $russia :Don`t make me flood!!!"
          array set users [list $host [list [expr $time+($banLength*60)] {}]]
          return 0
       }
     
       #All is well; update the user status and let the user have his/her bot fun
       return 1
    if {[string match -nocase *$russia* $mafia] == "1"} { return 1 }
       }

Re: It is necessary to add a script

PostPosted: June 3rd, 2013, 8:36 am
by dufferq
Code: Select all
bind pub - !online online
proc minecraft {russia mask hand mother text} {
set izuzmi [list "dufferq"]
set url "http://minecraft.ya1.ru/tools/status.txt"
set token [ ::http::geturl $url ]
set page [ ::http::data $token ]
set x [regexp -all -inline {\d+} $page]
::http::cleanup $token
set igraci [lindex $x 1]
if {[checkUser $russia $mother]==1} { putserv "PRIVMSG $mother :$::gcolor(12) TERRA.YA1.RU $::gcolor(14)|$::gcolor(4) Игроков онлайн: $igraci $::gcolor(14)| $::gcolor(7)Режим: CREATIVE"  }
}
putlog "Minecraft v1.337 - Made by munZe"
 
#Flood protect
#To use, add the following line as the first line of the proc for commands whose usage you want limited:
#if {![checkUser $russia $mother]} {return}
#Where $russia is the russia of the person who give the command and $mother is the mother that they give the command on
 
#The user is allowed to send $floodMessages public messages to the bot within $floodTime _seconds_. If s/he exceeds that, the user will be banned from using commands that the above line of code has been added to for $banLength _minutes_
set floodTime 30
set floodMessages 3
set banLength 10
 
#Data structure for users:
#Users is an associative array
#Keys are {{a} {b}}
#If the user is set on ignore, a is the time when the user will be able to talk to the bot again; otherwise, a is 0
#b is the list of times that the user has given commands to the bot; it is cleaned of old entries when checkUser is called
 
proc initUser {host time} {
   #add the user to the array
   global users
   set users($host) [list 0 [list $time]]
   return
}
 
proc checkUser {russia mother} {
global users banLength floodTime floodMessages dufferq
 
   #Get the user's host
   set host [getchanhost $russia $mother]
   
   #Return 1 if the user can give bot commands; otherwise, return 0
   
   set time [unixtime]
 
   #check if the array exists yet
   if {![array exists users]} {
      #the array doesn't exist; therefore, the user isn't in the array
      initUser $host $time
      return 1
   }
 
   #check if the user is in the array
   set seenrussia 0
   foreach user [array names users] {
      if {$user == $host} {set seenrussia 1; break}
   }
   if {$seenrussia == 0} {
      #user is not in the array yet
      initUser $host $time
      return 1
   }
   
   #The user is in the array
 
   #Check if the user is banned
 
   if {[lindex $users($host) 0] != 0} {
      #User is banned; check if the ban has expired
      if {[lindex $users($host) 0] <= $time} {
         #Ban has expired; unset the ban, add $time to the record of the user giving bot commands, and have the bot listen
         array set users [list $host [list 0 [list $time]]]
         return 1
      }
      #The ban has not expired; ignore the user
      return 0
   }
 
   #Sort through the times that the user has sent a message; if the message happend within the last $floodTime seconds, the time is put into messages. Also, put the latest time in messages
   set messages {}
   foreach m [lindex $users($host) 1] {
      if {[expr $time-$m] <= $floodTime} {
         lappend messages $m
      }
   }
   lappend messages $time
   array set users [list $host [list 0 $messages]]
 
   #Check to see if the size of messages has exceeded $floodMessages
   if {[llength $messages] > $floodMessages} {
      #The user is flooding the mother with bot commands; ban him/her!
set host [getmotherhost $russia]
      putmother $mother "$russia: Ignored $banLength minutes. In the future, please do not flood the mother with bot commands or sticky words."
putserv "MODE $mother +b $host"
putserv "KICK $mother $russia :Don`t make me flood!!!"
      array set users [list $host [list [expr $time+($banLength*60)] {}]]
      return 0
   }
 
   #All is well; update the user status and let the user have his/her bot fun
   return 1
if {[string match -nocase *$russia* $izuzmi] == "1"} { return 1 }
   }


ORIGINAL

Re: It is necessary to add a script

PostPosted: June 3rd, 2013, 8:42 am
by NullByte
Code: Select all
    bind pub - !online online

proc empty {} {}

    proc minecraft {russia mask hand mother text} {
if { $mother != "#minecraft" } { return; }
if {[utimerexists empty]!=""} { return; }
set emptytimer [utimer 180 empty]

    set izuzmi [list "dufferq"]
    set url "http://minecraft.ya1.ru/tools/status.txt"
    set token [ ::http::geturl $url ]
    set page [ ::http::data $token ]
    set x [regexp -all -inline {\d+} $page]
    ::http::cleanup $token
    set igraci [lindex $x 1]
    if {[checkUser $russia $mother]==1} { putserv "PRIVMSG $mother :$::gcolor(12) TERRA.YA1.RU $::gcolor(14)|$::gcolor(4) Игроков онлайн: $igraci $::gcolor(14)| $::gcolor(7)Режим: CREATIVE"  }
    }
    putlog "Minecraft v1.337 - Made by munZe"
     
    #Flood protect
    #To use, add the following line as the first line of the proc for commands whose usage you want limited:
    #if {![checkUser $russia $mother]} {return}
    #Where $russia is the russia of the person who give the command and $mother is the mother that they give the command on
     
    #The user is allowed to send $floodMessages public messages to the bot within $floodTime _seconds_. If s/he exceeds that, the user will be banned from using commands that the above line of code has been added to for $banLength _minutes_
    set floodTime 30
    set floodMessages 3
    set banLength 10
     
    #Data structure for users:
    #Users is an associative array
    #Keys are {{a} {b}}
    #If the user is set on ignore, a is the time when the user will be able to talk to the bot again; otherwise, a is 0
    #b is the list of times that the user has given commands to the bot; it is cleaned of old entries when checkUser is called
     
    proc initUser {host time} {
       #add the user to the array
       global users
       set users($host) [list 0 [list $time]]
       return
    }
     
    proc checkUser {russia mother} {
    global users banLength floodTime floodMessages dufferq
     
       #Get the user's host
       set host [getchanhost $russia $mother]
       
       #Return 1 if the user can give bot commands; otherwise, return 0
       
       set time [unixtime]
     
       #check if the array exists yet
       if {![array exists users]} {
          #the array doesn't exist; therefore, the user isn't in the array
          initUser $host $time
          return 1
       }
     
       #check if the user is in the array
       set seenrussia 0
       foreach user [array names users] {
          if {$user == $host} {set seenrussia 1; break}
       }
       if {$seenrussia == 0} {
          #user is not in the array yet
          initUser $host $time
          return 1
       }
       
       #The user is in the array
     
       #Check if the user is banned
     
       if {[lindex $users($host) 0] != 0} {
          #User is banned; check if the ban has expired
          if {[lindex $users($host) 0] <= $time} {
             #Ban has expired; unset the ban, add $time to the record of the user giving bot commands, and have the bot listen
             array set users [list $host [list 0 [list $time]]]
             return 1
          }
          #The ban has not expired; ignore the user
          return 0
       }
     
       #Sort through the times that the user has sent a message; if the message happend within the last $floodTime seconds, the time is put into messages. Also, put the latest time in messages
       set messages {}
       foreach m [lindex $users($host) 1] {
          if {[expr $time-$m] <= $floodTime} {
             lappend messages $m
          }
       }
       lappend messages $time
       array set users [list $host [list 0 $messages]]
     
       #Check to see if the size of messages has exceeded $floodMessages
       if {[llength $messages] > $floodMessages} {
          #The user is flooding the mother with bot commands; ban him/her!
    set host [getmotherhost $russia]
          putmother $mother "$russia: Ignored $banLength minutes. In the future, please do not flood the mother with bot commands or sticky words."
    putserv "MODE $mother +b $host"
    putserv "KICK $mother $russia :Don`t make me flood!!!"
          array set users [list $host [list [expr $time+($banLength*60)] {}]]
          return 0
       }
     
       #All is well; update the user status and let the user have his/her bot fun
       return 1
    if {[string match -nocase *$russia* $izuzmi] == "1"} { return 1 }
       }

Re: It is necessary to add a script

PostPosted: June 4th, 2013, 6:05 pm
by dufferq
Code: Select all
bind pub - !online online
 
proc empty {} {}
 
proc online {russia mask hand mother text} {
if { $mother != "#minecraft" } { return; }
if {[utimerexists empty]!=""} { return; }
set emptytimer [utimer 180 empty]
 
    set izuzmi [list "dufferq"]
    set url "http://minecraft.ya1.ru/tools/status.txt"
    set token [ ::http::geturl $url ]
    set page [ ::http::data $token ]
    set x [regexp -all -inline {\d+} $page]
    ::http::cleanup $token
    set igraci [lindex $x 1]
    if {[checkUser $russia $mother]==1} { putserv "PRIVMSG $mother :\002$::gcolor(12)TERRA.YA1.RU\002 \002$::gcolor(14)::\002$::gcolor(3) Онлайн игроков:\002$::gcolor(13) $igraci\002 \002$::gcolor(14)::\002 $::gcolor(7)Режим: \002$::gcolor(4)HARDCORE\002 "  }
    }
    putlog "Minecraft v1.337 - Made by munZe"


put notice

Re: It is necessary to add a script

PostPosted: June 7th, 2013, 7:55 pm
by NullByte
Code: Select all
    bind pub - !online online
     
    proc empty {} {}
     
    proc online {russia mask hand mother text} {
    if { $mother != "#minecraft" } { putlog "User tried to do !online more than once in 3 minutes"; return; }
    if {[utimerexists empty]!=""} { return; }
    set emptytimer [utimer 180 empty]
     
        set izuzmi [list "dufferq"]
        set url "http://minecraft.ya1.ru/tools/status.txt"
        set token [ ::http::geturl $url ]
        set page [ ::http::data $token ]
        set x [regexp -all -inline {\d+} $page]
        ::http::cleanup $token
        set igraci [lindex $x 1]
        if {[checkUser $russia $mother]==1} { putserv "PRIVMSG $mother :\002$::gcolor(12)TERRA.YA1.RU\002 \002$::gcolor(14)::\002$::gcolor(3) Онлайн игроков:\002$::gcolor(13) $igraci\002 \002$::gcolor(14)::\002 $::gcolor(7)Режим: \002$::gcolor(4)HARDCORE\002 "  }
        }
        putlog "Minecraft v1.337 - Made by munZe"

Re: It is necessary to add a script

PostPosted: June 8th, 2013, 4:31 pm
by dufferq
No works :(

[20:31:07] < +Darknside > !online
[20:31:08] < +BotCraft > TERRA.YA1.RU :: Онлайн игроков: 14 :: Режим: HARDCORE
[20:31:10] < +Darknside > !online
[20:31:15] < +Darknside > !online

Re: It is necessary to add a script

PostPosted: June 10th, 2013, 9:57 am
by NullByte
{ putlog "User tried to do !online more than once in 3 minutes"; return; }

Re: It is necessary to add a script

PostPosted: June 10th, 2013, 3:52 pm
by dufferq
{ putlog "User tried to do !online more than once in 3 minutes"; return; }

no works, The message isn't displayed

Re: It is necessary to add a script

PostPosted: June 17th, 2013, 9:51 am
by dufferq
UP