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.

Voting script (very needed)

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Voting script (very needed)

Post by samhain »

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
<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.
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

hmm, try it:

Code: Select all

# 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"
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

Code: Select all

# 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 :D
* 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-> :P
<@SmuGGler> :P~
<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]
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

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

Code: Select all

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.
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

try this - but please modify it after test:

Code: Select all

# 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"
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

Yes your code is working perfectly well :), 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.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

Code: Select all

# 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.
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

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
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

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.
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

find in code section:

Code: Select all

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: Select all

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
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

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.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

anyone? can anyone please fix this bug and make this script working, tomek has made efforts to create it.
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

hard to write something cause this script is working on my eggy i see the files inside, hmm
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

does the script work fine for you?
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

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 :)
Post Reply