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 

Voting script (very needed)
Goto page 1, 2  Next
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Thu Apr 14, 2011 8:25 am    Post subject: Voting script (very needed) Reply with quote

Hi, I have a script in mIRC scripting, But I'm sick of the bugs it has, and also I want to have it on an eggdrop because that disturbs my normal IRC routine.
I want a script where any normal users can vote a particular user on the channel for a ban via X, The maximum numbers of votes required should be modified in the script. A general example would be
Quote:

<samhain> !vote user yes
<BOT> samhain voted user Yes. (1) Votes.
<samhain1> !vote user yes
<BOT> samhain voted user Yes. (2) Votes.
<samhain3> !vote user no
<BOT> samhain voted user (No). (1) Votes.

If the number reaches 5, then the bot should go for the ban if the number is less than 5, then the user should be allowed to stay in the channel, Also an option that the user can only vote once and not twice.
Thanks.
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sun Apr 17, 2011 6:14 am    Post subject: Reply with quote

hmm, try it:
Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
#
# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)                 
# .chanset #channel_name +vote
# and later .save   

# ban after X yes votes
set vote_limit 5

# dir with users data
set users_dir "users"

# kick msg
set kick_msg "bye!"

###############################################################################################
bind pub -|- !vote vote_proc

setudef flag vote

if {![file exists $users_dir]} {                                                                             
   file mkdir $users_dir
}

proc put_host { user_host voter_host chan } {
   global users_dir

   set put_vote [open $users_dir/$chan/$user_host a]
   puts $put_vote $voter_host
   close $put_vote
}

proc get_hosts { user_host chan } {
   global users_dir

   set get_hosts [open $users_dir/$chan/$user_host r]
   set get_all [split [read $get_hosts] "\n"]
   close $get_hosts

   return $get_all
}

proc del_host { user_host voter_host chan } {
   global users_dir

   set old_votes [get_hosts $user_host $chan]

   set new_votes [open $users_dir/$chan/$user_host w]
   foreach host $old_votes {
      if {$host != ""} {
         if {$host != $voter_host} {
            puts $new_votes $host
         }
      }
   }
   close $new_votes
}

proc check_host { user_host voter_host chan } {
   set host_exists 0

   foreach host [get_hosts $user_host $chan] {
      if {$host != ""} {
         if {$host == $voter_host} {
            set host_exists 1
            break
         }
      }
   }

   return $host_exists
}

proc vote_proc { nick uhost hand chan arg } {
   global users_dir vote_limit botnick kick_msg

   set args [split $arg]
   set user [lindex $args 0]
   set yes_or_no [lindex $args 1]

   if {![channel get $chan vote]} {
      return                                                                                         
   } 

   if {[isbotnick $user]} {
      return
   }
   
   if {[file exists $users_dir/$chan/$uhost]} {
      return
   }

   if {![file exists $users_dir/$chan]} {
      file mkdir $users_dir/$chan
   }

   if {$user != ""} {
      if {($yes_or_no == "yes") || ($yes_or_no == "no")} {
         if {[onchan $user $chan]} {
            set user_host [getchanhost $user $chan]

            if {$yes_or_no == "yes"} {
               if {![file exists $users_dir/$chan/$user_host]} {
                  set touch_user [open $users_dir/$chan/$user_host w]
                  close $touch_user
               }

               set user_host_counter [llength [get_hosts $user_host $chan]]
               if {$user_host_counter < $vote_limit} {
                  if {[check_host $user_host [getchanhost $nick $chan] $chan] == 0} {
                     put_host $user_host [getchanhost $nick $chan] $chan

                     if {$user_host_counter == 0} {            
                        putquick "PRIVMSG $chan :$nick voted $user Yes. (1) Votes."
                     } {
                        putquick "PRIVMSG $chan :$nick voted $user Yes. ($user_host_counter) Votes."
                     }
                  } {
                     putquick "PRIVMSG $nick :sorry, you can't vote yes twice on the same user"
                  }
               } {
                  putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes."
                  putquick "MODE $chan +b *!*$user_host"
                  
                  putkick $chan $user $kick_msg

                  file delete $users_dir/$chan/$user_host
               }
            }

            if {$yes_or_no == "no"} {
               if {![file exists $users_dir/$chan/$user_host]} {
                  putquick "PRIVMSG $nick :sorry, no one voted on this user before"
               }

               set user_host_counter [llength [get_hosts $user_host $chan]]
               
               if {$user_host_counter > 0} {
                  set user_host_counter [expr $user_host_counter - 1]
               }

               if {$user_host_counter == 1} {
                  putquick "PRIVMSG $chan :$nick voted $user No. (0) Votes."
                  file delete $users_dir/$chan/$user_host
               } {
                  if {[check_host $user_host [getchanhost $nick $chan] $chan] == 1} {
                     del_host $user_host [getchanhost $nick $chan] $chan
                     putquick "PRIVMSG $chan :$nick voted $user No. ([expr $user_host_counter - 1]) Votes."
                  } {
                     putquick "PRIVMSG $nick :sorry, you didn't vote for this user"
                  }
               }
            }
         } {
            putquick "PRIVMSG $nick :wrong user name"
         }
      } {
         putquick "PRIVMSG $nick :use: !vote <user> <yes/no>"
      }
   } {
      putquick "PRIVMSG $nick :use: !vote <user> <yes/no>"
   }
}

putlog "simple-vote.tcl ver 0.1 by tomekk loaded"
Back to top
View user's profile Send private message Visit poster's website
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Sun Apr 17, 2011 1:44 pm    Post subject: Reply with quote

Code:

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
#
# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)                 
# .chanset #channel_name +vote
# and later .save   

# ban after X yes votes
set vote_limit 5

# dir with users data
set users_dir "/home/borg/eggdrop"

# kick msg
set kick_msg "You have been Rule8'ed, Now eat [censored]"

###############################################################################################
bind pub -|- !rule8 vote_proc

setudef flag vote

if {![file exists $users_dir]} {                                                                             
   file mkdir $users_dir
}

proc put_host { user_host voter_host chan } {
   global users_dir

   set put_vote [open $users_dir/$chan/$user_host a]
   puts $put_vote $voter_host
   close $put_vote
}

proc get_hosts { user_host chan } {
   global users_dir

   set get_hosts [open $users_dir/$chan/$user_host r]
   set get_all [split [read $get_hosts] "\n"]
   close $get_hosts

   return $get_all
}

proc del_host { user_host voter_host chan } {
   global users_dir

   set old_votes [get_hosts $user_host $chan]

   set new_votes [open $users_dir/$chan/$user_host w]
   foreach host $old_votes {
      if {$host != ""} {
         if {$host != $voter_host} {
            puts $new_votes $host
         }
      }
   }
   close $new_votes
}

proc check_host { user_host voter_host chan } {
   set host_exists 0

   foreach host [get_hosts $user_host $chan] {
      if {$host != ""} {
         if {$host == $voter_host} {
            set host_exists 1
            break
         }
      }
   }

   return $host_exists
}

proc vote_proc { nick uhost hand chan arg } {
   global users_dir vote_limit botnick kick_msg

   set args [split $arg]
   set user [lindex $args 0]
   set yes_or_no [lindex $args 1]

   if {![channel get $chan vote]} {
      return                                                                                         
   }

   if {[isbotnick $user]} {
      return
   }
   
   if {[file exists $users_dir/$chan/$uhost]} {
      return
   }

   if {![file exists $users_dir/$chan]} {
      file mkdir $users_dir/$chan
   }

   if {$user != ""} {
      if {($yes_or_no == "yes") || ($yes_or_no == "no")} {
         if {[onchan $user $chan]} {
            set user_host [getchanhost $user $chan]

            if {$yes_or_no == "yes"} {
               if {![file exists $users_dir/$chan/$user_host]} {
                  set touch_user [open $users_dir/$chan/$user_host w]
                  close $touch_user
               }

               set user_host_counter [llength [get_hosts $user_host $chan]]
               if {$user_host_counter < $vote_limit} {
                  if {[check_host $user_host [getchanhost $nick $chan] $chan] == 0} {
                     put_host $user_host [getchanhost $nick $chan] $chan

                     if {$user_host_counter == 0} {           
                        putquick "PRIVMSG $chan :$nick voted $user Yes. (1) Votes."
                     } {
                        putquick "PRIVMSG $chan :$nick voted $user Yes. ($user_host_counter) Votes."
                     }
                  } {
                     putquick "PRIVMSG $nick :sorry, you can't vote yes twice on the same user"
                  }
               } {
                  putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes
                  putquick "PRIVMSG X :ban $chan *!*$user_host $kick_msg

                  file delete $users_dir/$chan/$user_host
               }
            }

            if {$yes_or_no == "no"} {
               if {![file exists $users_dir/$chan/$user_host]} {
                  putquick "PRIVMSG $nick :sorry, no one voted on this user before"
               }

               set user_host_counter [llength [get_hosts $user_host $chan]]
               
               if {$user_host_counter > 0} {
                  set user_host_counter [expr $user_host_counter - 1]
               }

               if {$user_host_counter == 1} {
                  putquick "PRIVMSG $chan :$nick voted $user No. (0) Votes."
                  file delete $users_dir/$chan/$user_host
               } {
                  if {[check_host $user_host [getchanhost $nick $chan] $chan] == 1} {
                     del_host $user_host [getchanhost $nick $chan] $chan
                     putquick "PRIVMSG $chan :$nick voted $user No. ([expr $user_host_counter - 1]) Votes."
                  } {
                     putquick "PRIVMSG $nick :sorry, you didn't vote for this user"
                  }
               }
            }
         } {
            putquick "PRIVMSG $nick :wrong user name"
         }
      } {
         putquick "PRIVMSG $nick :use: !rule8 <user> <yes/no>"
      }
   } {
      putquick "PRIVMSG $nick :use: !rule8 <user> <yes/no>"
   }
}

I modified your script to that, to have X bans, the script is having a few errors.
<Hawk-> !vote Hawk- yes
<Goodbad> hey argentio
* keeperr (~keeper@189.107.5.147) has left #usa
<@Flubber> Hawk- voted Hawk- Yes. (1) Votes.
* @Enkeli faints
<@SmuGGler> fire fireee!!!!!!
<@iJump> evening
<@SmuGGler> fire in the holeeeeeeeeee!
<@SmuGGler> LOL
<Goodbad> hope there is in Argentino no carnivals
<Goodbad> like in Brazil
<@Enkeli> !vote Hawk- yes
<@Flubber> Enkeli voted Hawk- Yes. (2) Votes.
<@agent^> !vote Hawk- yes
<@Flubber> agent^ voted Hawk- Yes. (3) Votes.
<@agent^> !vote Cute^Kitten yes
<Goodbad> or yes?
<@Flubber> agent^ voted Cute^Kitten Yes. (1) Votes.
<@SmuGGler> !kote Hawk- No Very Happy
* moul7out (~ASAD-ATLA@41.248.227.123) has joined #usa
<@Enkeli> !vote Enkeli Yes
<@SmuGGler> what this vote for? :p
<@agent^> !vote Enkeli -yes
<Hawk-> lol
<Hawk-> this is for ban
<@SmuGGler> !vote Cute^Kitten Yes
<@SmuGGler> !vote Cute^Kitten Yes
<Hawk-> Razz
<@SmuGGler> Razz~
<Hawk-> !vote Hawk- yes
<@SmuGGler> what ban? O_O
<@Enkeli> !vote Enkeli Yes

There it's only responding to the first votes to Hawk- nick, and wasn't responding to the voting of the other users, also when the limit of the voting reaches to 5, it shows this message in DCC <(Flubber> [19:39:43] Tcl error [vote_proc]: extra characters after close-quote

<BallotBox> !vote Hawk- yes
<@Flubber> BallotBox voted Hawk- Yes. (1) Votes.
<Ompahpah> !vote hawk- yes
<@Flubber> Ompahpah voted hawk- Yes. (2) Votes.
<@Hawk-> !vote Hawk- yes
<@Hawk-> !vote Hawk- no
-> [luggage] CHAT
* Luggage (XI@little.baby.can.you.say-owned.us) has joined #Islamabad
* X sets mode: +l 24
<Luggage> !vote Hawk- yes
<@Flubber> Luggage voted Hawk- Yes. (3) Votes.
-> [Area88] CHAT
* AREA88 (usa@Hawk24.users.undernet.org) has joined #Islamabad
* X sets mode: +o AREA88
* AREA88 sets mode: +b *!*@190.166.24.*
<@AREA88> !vote Hawk- yes
* X sets mode: +l 26
<@AREA88> !vote Hawk- no
<Luggage> !vote Hawk- no
<@Flubber> Luggage voted Hawk- No. (2) Votes.

Luggage in there voted 2 times, 1 for yes and 1 for no, I want it so that a person can only do yes or no.
Goodness, that's a good one, I'll need a few modifications there, 1. It doesn't work on ops if some one tries to yes that vote on a person who is @ status on the channel, it should give reply on the user's private, You can't rule8 an operator, and the kick messages should be a random like set kick_msg "message 1" "message 2" I would want to have up to 10 random kick messages. please. Thanks for your help. really appreciated. [/quote]
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sun Apr 17, 2011 4:30 pm    Post subject: Reply with quote

next time, please do not copy whole post...

Code:
putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes
putquick "PRIVMSG X :ban $chan *!*$user_host $kick_msg


You've modified this script but check what is wrong with those two lines :>
Where is " at the end? ;P

Anyway, I will fix those kick msgs and other ASAP.
Back to top
View user's profile Send private message Visit poster's website
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Sun Apr 17, 2011 4:56 pm    Post subject: Reply with quote

try this - but please modify it after test:
Code:
# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
#
# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)                 
# .chanset #channel_name +vote
# and later .save   

# ban after X yes votes
set vote_limit 5

# dir with users data
set users_dir "users"

# kick messages
set kick_msgs {
   "message 1"
   "message 2"
   "message 3"
   "message N"
}

###############################################################################################
bind pub -|- !vote vote_proc

setudef flag vote

if {![file exists $users_dir]} {                                                                             
   file mkdir $users_dir
}

proc put_host { user_host voter_host chan } {
   global users_dir

   set put_vote [open $users_dir/$chan/$user_host a]
   puts $put_vote $voter_host
   close $put_vote
}

proc get_hosts { user_host chan } {
   global users_dir

   set get_hosts [open $users_dir/$chan/$user_host r]
   set get_all [split [read $get_hosts] "\n"]
   close $get_hosts

   return $get_all
}

proc del_host { user_host voter_host chan } {
   global users_dir

   set old_votes [get_hosts $user_host $chan]

   set new_votes [open $users_dir/$chan/$user_host w]
   foreach host $old_votes {
      if {$host != ""} {
         if {$host != $voter_host} {
            puts $new_votes $host
         }
      }
   }
   close $new_votes
}

proc check_host { user_host voter_host chan } {
   set host_exists 0

   foreach host [get_hosts $user_host $chan] {
      if {$host != ""} {
         if {$host == $voter_host} {
            set host_exists 1
            break
         }
      }
   }

   return $host_exists
}

proc vote_proc { nick uhost hand chan arg } {
   global users_dir vote_limit botnick kick_msgs

   set args [split $arg]
   set user [lindex $args 0]
   set yes_or_no [lindex $args 1]

   if {![channel get $chan vote]} {
      return                                                                                         
   } 

   if {[isbotnick $user]} {
      return
   }
   
   if {[file exists $users_dir/$chan/$uhost]} {
      return
   }

   if {![file exists $users_dir/$chan]} {
      file mkdir $users_dir/$chan
   }

   if {$user != ""} {
      if {($yes_or_no == "yes") || ($yes_or_no == "no")} {
         if {[onchan $user $chan]} {
            if {![isop $user $chan]} {
               set user_host [getchanhost $user $chan]
   
               if {$yes_or_no == "yes"} {
                  if {![file exists $users_dir/$chan/$user_host]} {
                     set touch_user [open $users_dir/$chan/$user_host w]
                     close $touch_user
                  }

                  set user_host_counter [llength [get_hosts $user_host $chan]]
                  if {$user_host_counter < $vote_limit} {
                     if {[check_host $user_host [getchanhost $nick $chan] $chan] == 0} {
                        put_host $user_host [getchanhost $nick $chan] $chan
   
                        if {$user_host_counter == 0} {            
                           putquick "PRIVMSG $chan :$nick voted $user Yes. (1) Votes."
                        } {
                           putquick "PRIVMSG $chan :$nick voted $user Yes. ($user_host_counter) Votes."
                        }
                     } {
                        putquick "PRIVMSG $nick :sorry, you can't vote twice on the same user"
                     }
                  } {
                     putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes."
                     putquick "MODE $chan +b *!*$user_host"
                     
                     putkick $chan $user [lindex $kick_msgs [expr {int(rand() * [llength $kick_msgs])}]]
   
                     file delete $users_dir/$chan/$user_host
                  }
               }
   
               if {$yes_or_no == "no"} {
                  if {![file exists $users_dir/$chan/$user_host]} {
                     putquick "PRIVMSG $nick :sorry, no one voted on this user before"
                     return
                  }

                  if {[check_host $user_host [getchanhost $nick $chan] $chan] == 0} {
                     set user_host_counter [llength [get_hosts $user_host $chan]]
                     
                     if {$user_host_counter > 0} {
                        set user_host_counter [expr $user_host_counter - 1]
                     }
      
                     if {$user_host_counter == 1} {
                        putquick "PRIVMSG $chan :$nick voted $user No. (0) Votes."
                        file delete $users_dir/$chan/$user_host
                     } {
                        del_host $user_host [getchanhost $nick $chan] $chan
                        putquick "PRIVMSG $chan :$nick voted $user No. ([expr $user_host_counter - 1]) Votes."
                     }
                         
                  } {
                     putquick "PRIVMSG $nick :sorry, you can't vote twice on the same user"
                  }
               }
            } {
               putquick "PRIVMSG $nick :You can't rule8 an operator"
            }
         } {
            putquick "PRIVMSG $nick :wrong user name"
         }
      } {
         putquick "PRIVMSG $nick :use: !vote <user> <yes/no>"
      }
   } {
      putquick "PRIVMSG $nick :use: !vote <user> <yes/no>"
   }
}

putlog "simple-vote.tcl ver 0.1 by tomekk loaded"
Back to top
View user's profile Send private message Visit poster's website
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Sun Apr 17, 2011 7:27 pm    Post subject: Reply with quote

Yes your code is working perfectly well Smile, I'd love if you could make the ban via X, as I want the ban to last for 3 hours, and if the ban is removed from the manual banlist, the user will rejoin, it should be some thing like PRIV MSG X BAN: $chan *!*$user_host but I don't want to touch the code, as I'm not a coder, thanks.
Back to top
View user's profile Send private message
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Mon Apr 18, 2011 9:29 am    Post subject: Reply with quote

Code:
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html
#
# if you want to use this script on your chan, type in eggdrop console (via telnet or DCC chat)                 
# .chanset #channel_name +vote
# and later .save   

# ban after X yes votes
set vote_limit 2

# dir with users data
set users_dir "/home/borg/eggdrop/users"

# kick messages
set kick_msgs {
   "message 1"
   "message 2"
   "message 3"
   "message N"
}

###############################################################################################
bind pub -|- !vote vote_proc

setudef flag vote

if {![file exists $users_dir]} {                                                                             
   file mkdir $users_dir
}

proc put_host { user_host voter_host chan } {
   global users_dir

   set put_vote [open $users_dir/$chan/$user_host a]
   puts $put_vote $voter_host
   close $put_vote
}

proc get_hosts { user_host chan } {
   global users_dir

   set get_hosts [open $users_dir/$chan/$user_host r]
   set get_all [split [read $get_hosts] "\n"]
   close $get_hosts

   return $get_all
}

proc del_host { user_host voter_host chan } {
   global users_dir

   set old_votes [get_hosts $user_host $chan]

   set new_votes [open $users_dir/$chan/$user_host w]
   foreach host $old_votes {
      if {$host != ""} {
         if {$host != $voter_host} {
            puts $new_votes $host
         }
      }
   }
   close $new_votes
}

proc check_host { user_host voter_host chan } {
   set host_exists 0

   foreach host [get_hosts $user_host $chan] {
      if {$host != ""} {
         if {$host == $voter_host} {
            set host_exists 1
            break
         }
      }
   }

   return $host_exists
}

proc vote_proc { nick uhost hand chan arg } {
   global users_dir vote_limit botnick kick_msgs

   set args [split $arg]
   set user [lindex $args 0]
   set yes_or_no [lindex $args 1]

   if {![channel get $chan vote]} {
      return                                                                                         
   }

   if {[isbotnick $user]} {
      return
   }
   
   if {[file exists $users_dir/$chan/$uhost]} {
      return
   }

   if {![file exists $users_dir/$chan]} {
      file mkdir $users_dir/$chan
   }

   if {$user != ""} {
      if {($yes_or_no == "yes") || ($yes_or_no == "no")} {
         if {[onchan $user $chan]} {
            if {![isop $user $chan]} {
               set user_host [getchanhost $user $chan]
   
               if {$yes_or_no == "yes"} {
                  if {![file exists $users_dir/$chan/$user_host]} {
                     set touch_user [open $users_dir/$chan/$user_host w]
                     close $touch_user
                  }

                  set user_host_counter [llength [get_hosts $user_host $chan]]
                  if {$user_host_counter < $vote_limit} {
                     if {[check_host $user_host [getchanhost $nick $chan] $chan] == 0} {
                        put_host $user_host [getchanhost $nick $chan] $chan
   
                        if {$user_host_counter == 0} {           
                           putquick "PRIVMSG $chan :12$nick voted 4$user12 Yes. (1) Votes."
                        } {
                           putquick "PRIVMSG $chan :12$nick voted 4$user12 Yes. ($user_host_counter) Votes."
                        }
                     } {
                        putquick "PRIVMSG $nick :12sorry, you can't vote twice on the same user"
                     }
                  } {
                     putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes. $user now you're Gone biatch!"
                     putquick "PRIVMSG X :ban $chan *!*$user_host [lindex $kick_msgs [expr {int(rand() * [llength $kick_msgs])}]]"
                     
   
                     file delete $users_dir/$chan/$user_host
                  }
               }
   
               if {$yes_or_no == "no"} {
                  if {![file exists $users_dir/$chan/$user_host]} {
                     putquick "PRIVMSG $nick :sorry, no one voted on this user before"
                     return
                  }

                  if {[check_host $user_host [getchanhost $nick $chan] $chan] == 0} {
                     set user_host_counter [llength [get_hosts $user_host $chan]]
                     
                     if {$user_host_counter > 0} {
                        set user_host_counter [expr $user_host_counter - 1]
                     }
     
                     if {$user_host_counter == 1} {
                        putquick "PRIVMSG $chan :$nick voted $user No. (0) Votes."
                        file delete $users_dir/$chan/$user_host
                     } {
                        del_host $user_host [getchanhost $nick $chan] $chan
                        putquick "PRIVMSG $chan :$nick voted $user No. ([expr $user_host_counter - 1]) Votes."
                     }
                         
                  } {
                     putquick "PRIVMSG $nick :sorry, you can't vote twice on the same user"
                  }
               }
            } {
               putquick "PRIVMSG $nick :You can't rule8 an operator"
            }
         } {
            putquick "PRIVMSG $nick :wrong user name"
         }
      } {
         putquick "PRIVMSG $nick :use: !vote <user> <yes/no>"
      }
   } {
      putquick "PRIVMSG $nick :use: !vote <user> <yes/no>"
   }
}

putlog "simple-vote.tcl ver 0.1 by tomekk loaded"


That's the code currently I am using the bans on X are working fine except for one problem which appeared after 4 hours, When the script was tested first, it was perfect, the problem appeared later. ...

<+Hawk-> !vote Ompahpah yes
<@Flubber> Hawk- voted Ompahpah Yes. (1) Votes.
<+Hawk-> !vote Ompahpah yes
<@Flubber> Hawk- voted Ompahpah Yes. (2) Votes. Ompahpah now you're Gone biatch!
* X sets mode: +b *!*usa@i.farted.be
* Ompahpah was kicked by X ((LilleHopp) message 1)

You see I voted Ompahpah twice, and it didn't refused my vote, so did another user voted thrice for me when I set the limit to 3. Thanks.
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Tue Apr 19, 2011 3:37 am    Post subject: Reply with quote

did you change your ident/host during this 4 hours?
cause script is checking users by ident/host not by nick and if you change your host you become completely new user for the script
Back to top
View user's profile Send private message Visit poster's website
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Tue Apr 19, 2011 4:10 pm    Post subject: Reply with quote

No, I didn't change my ident, nick or host, also that 3 other users complained about me the same problem. I have a static Ip address as well.
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Thu Apr 21, 2011 3:57 am    Post subject: Reply with quote

find in code section:

Code:
putquick "MODE $chan +b *!*$user_host"            
putkick $chan $user [lindex $kick_msgs [expr {int(rand() * [llength $kick_msgs])}]]
file delete $users_dir/$chan/$user_host


for tests, please remove the line:

Code:
file delete $users_dir/$chan/$user_host

reload the bot,

Make some votes, if some user will get banned again by the votes from the same people please paste here the file of this banned host, it will be located in:
dir with hosts | channel name | host of the banned user
$users_dir/$chan/$user_hos
Back to top
View user's profile Send private message Visit poster's website
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Fri Apr 22, 2011 12:02 pm    Post subject: Reply with quote

All I see in the eggdrop/users directory is the channel names with #usa #islamabad and there are no files in those directories. I think It's having problems while saving the files.
Back to top
View user's profile Send private message
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Sun May 29, 2011 1:41 am    Post subject: Reply with quote

anyone? can anyone please fix this bug and make this script working, tomek has made efforts to create it.
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Jun 03, 2011 5:44 am    Post subject: Reply with quote

hard to write something cause this script is working on my eggy i see the files inside, hmm
Back to top
View user's profile Send private message Visit poster's website
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Tue Jun 21, 2011 5:07 am    Post subject: Reply with quote

does the script work fine for you?
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Wed Jun 22, 2011 5:16 am    Post subject: Reply with quote

Yeah, its working OK for me.
I think I have to rewrite it .. I mean change the style of saving users info.
But I need time for it and again testing, eh.

I will try to do that ASAP Smile
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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