<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forum.eggheads.org/app.php/feed/topic/18427" />

	<title>egghelp/eggheads community</title>
	<subtitle>Discussion of eggdrop bots, shell accounts and tcl scripts.</subtitle>
	<link href="https://forum.eggheads.org/index.php" />
	<updated>2011-07-28T13:28:20-04:00</updated>

	<author><name><![CDATA[egghelp/eggheads community]]></name></author>
	<id>https://forum.eggheads.org/app.php/feed/topic/18427</id>

		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-07-28T13:28:20-04:00</updated>

		<published>2011-07-28T13:28:20-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97291#p97291</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97291#p97291"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97291#p97291"><![CDATA[
delete old users.db before use this version,<br>try it:<div class="codebox"><p>Code: </p><pre><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 votesset vote_limit 3# delete user hosts older than X minutes plus +/- 1 minute for timer cycle# timestamp from the first voteset victim_interval 10# script messagesset vote_msg(is_bot) "Can't touch this!"set vote_msg(is_op) "Can't touch this!"set vote_msg(twice_on_same_user) "You can't vote twice on the same user!"set vote_msg(not_on_chan) "Wrong user name!"set vote_msg(help) "use: !vote &lt;user&gt; &lt;yes/no&gt;"set vote_msg(noone_voted) "No one voted for this user before!"# kick messagesset kick_msgs {"Come and get some!""No pain, no pain!""I'm your father Luke!""Hail to the king baby!"}# punish method# 0 - just kick# 1 - kick &amp; banset punish 1# ban type # 1)  *!*@*.domain.com # 2)  *!*@some.domain.com # 3)  *nick*!*@some.domain.com # 4)  *!*ident*@some.domain.comset bantype  4# file with users dataset users_file "users.db"###############################################################################################bind pub -|- !vote vote_procsetudef flag voteif {![file exists $users_file]} {                                                                             set file_handle [open $users_file w]close $file_handle}proc timestamp_timer { } {check_timestampsif {[string match *timestamp_timer* [utimers]] != 1} {utimer 60 timestamp_timer}}proc get_hosts { } { global users_fileset get_hosts [open $users_file r] set get_all [split [read $get_hosts] "\n"] close $get_hosts return $get_all }proc put_host { timestamp user_host voter_host } {global users_fileset put_host [open $users_file a] puts $put_host "$timestamp $user_host 1 $voter_host" close $put_host}proc del_host { user_host } {global users_fileset old_hosts [get_hosts]set del_hosts [open $users_file w]foreach del_host $old_hosts {if {$del_host != ""} {set del_rows [split $del_host " "]set del_user_timestamp [lindex $del_rows 0]set del_user_host [lindex $del_rows 1]set del_user_counter [lindex $del_rows 2]set del_user_voters [lindex $del_rows 3]if {$del_user_host != $user_host} {puts $del_hosts "$del_user_timestamp $del_user_host $del_user_counter $del_user_voters"}}}close $del_hosts}proc add_del_voter { user_host voter_host action } {global users_fileset old_db [get_hosts]set add_voter [open $users_file w]foreach old_host $old_db {if {$old_host != ""} {set old_rows [split $old_host " "]set old_user_timestamp [lindex $old_rows 0]set old_user_host [lindex $old_rows 1]set old_user_counter [lindex $old_rows 2]set old_user_voters [lindex $old_rows 3]if {$old_user_host == $user_host} {if {$action == "add"} {puts $add_voter "$old_user_timestamp $old_user_host [expr $old_user_counter + 1] $old_user_voters\,$voter_host"} elseif {$action == "del"} {if {$old_user_counter &gt; 1} {puts $add_voter "$old_user_timestamp $old_user_host [expr $old_user_counter - 1] $old_user_voters\,$voter_host"}}} {puts $add_voter "$old_user_timestamp $old_user_host $old_user_counter $old_user_voters"}}}close $add_voter}proc count_voters { user_host } {set voters_count 0foreach db_host [get_hosts] {if {$db_host != ""} {set db_rows [split $db_host " "]set db_user_host [lindex $db_host 1]set db_user_counter [lindex $db_host 2]if {$db_user_host == $user_host} {set voters_count $db_user_counterbreak}}}return $voters_count}proc check_user_host { user_host } {set host_exists "no"foreach host [get_hosts] { if {$host != ""} { set rows [split $host " "]set file_user_host [lindex $rows 1]if {$file_user_host == $user_host} {set host_exists "yes"break}}}return $host_exists}proc check_voter_host { user_host voter_host } {set voter_exists "no"foreach voter [get_hosts] {if {$voter != ""} {set voter_rows [split $voter " "]set voter_user_host [lindex $voter_rows 1]set voter_voters [lindex $voter_rows 3]if {$voter_user_host == $user_host} {set host_votes [split $voter_voters ","]foreach vote $host_votes {if {$vote != ""} {if {$vote == $voter_host} {set voter_exists "yes"break}}}}}}return $voter_exists}proc vote_proc { nick uhost hand chan arg } {global users_file vote_limit kick_msgs punish vote_msgset args [split $arg] set user [lindex $args 0] set yes_or_no [lindex $args 1]if {![channel get $chan vote]} { return                                                                                          }if {$user != ""} {if {[isbotnick $user]} {putquick "PRIVMSG $nick :$vote_msg(is_bot)"return}if {[isop $user $chan]} {putquick "PRIVMSG $nick :$vote_msg(is_op)"return}if {![onchan $user $chan]} {putquick "PRIVMSG $nick :$vote_msg(not_on_chan)"return}if {($yes_or_no == "yes") || ($yes_or_no == "no")} { set user_host [getchanhost $user $chan]if {$yes_or_no == "yes"} {if {[check_user_host $user_host] == "yes"} {if {[check_voter_host $user_host $uhost] == "no"} {set user_votes_counter [count_voters $user_host]if {[expr $user_votes_counter + 1] == $vote_limit} {putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes."del_host $user_hostif {$punish == 1} {putquick "MODE $chan +b [ban_mask $uhost $nick]" }putkick $chan $user [lindex $kick_msgs [expr {int(rand() * [llength $kick_msgs])}]]} {putquick "PRIVMSG $chan :$nick voted $user Yes. ([expr $user_votes_counter + 1]) Votes."add_del_voter $user_host $uhost "add"}} {putquick "PRIVMSG $nick :$vote_msg(twice_on_same_user)"}} {putquick "PRIVMSG $chan :$nick voted $user Yes. (1) Votes."put_host [clock seconds] $user_host $uhost}} elseif {$yes_or_no == "no"} {if {[check_user_host $user_host] == "yes"} {if {[check_voter_host $user_host $uhost] == "no"} {set user_votes_counter [count_voters $user_host]if {[expr $user_votes_counter - 1] == 0} {putquick "PRIVMSG $chan :$nick voted $user No. (0) Votes."} {putquick "PRIVMSG $chan :$nick voted $user No. ([expr $user_votes_counter - 1]) Votes."}add_del_voter $user_host $uhost "del"} {putquick "PRIVMSG $nick :$vote_msg(twice_on_same_user)"}} {putquick "PRIVMSG $nick :$vote_msg(noone_voted)"}}} {putquick "PRIVMSG $nick :$vote_msg(help)"}} {putquick "PRIVMSG $nick :$vote_msg(help)"}}proc ban_mask { host nick } {global bantypeswitch -- $bantype {1 {set bmask "*!*@[lindex [split [maskhost $host] "@"] 1]"}2 {set bmask "*!*@[lindex [split $host @] 1]"}3 {set bmask "*$nick*!*@[lindex [split $host "@"] 1]"}                4 {set bmask "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]"}return $bmask}}proc check_timestamps { } {global victim_interval users_fileset current_timestamp [clock seconds]set calc_timestamp [expr $victim_interval * 60]set timestamps_file [get_hosts]set fresh_timestamp [open $users_file w]foreach each_timestamp $timestamps_file {if {$each_timestamp != ""} {set victim_data [split $each_timestamp " "]set victim_timestamp [lindex $victim_data 0]if {[expr $current_timestamp - $victim_timestamp] &lt; $calc_timestamp} {puts $fresh_timestamp $each_timestamp}}}close $fresh_timestamp}if {[string match *timestamp_timer* [utimers]] != 1} {                                           utimer 60 timestamp_timer}  putlog "simple-vote.tcl ver 0.1 by tomekk loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Thu Jul 28, 2011 1:28 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[samhain]]></name></author>
		<updated>2011-07-27T10:59:19-04:00</updated>

		<published>2011-07-27T10:59:19-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97288#p97288</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97288#p97288"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97288#p97288"><![CDATA[
Yes sir a timer would be good, the voting should last round about 10 minutes. and the voting should be reset.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8567">samhain</a> — Wed Jul 27, 2011 10:59 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-07-26T17:34:28-04:00</updated>

		<published>2011-07-26T17:34:28-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97286#p97286</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97286#p97286"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97286#p97286"><![CDATA[
Hey,<br><br>Sorry about the lag, I was at the hospital.<br>Ok, is script working OK? <br>Do you need this timer for reset users counters?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Tue Jul 26, 2011 5:34 pm</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[samhain]]></name></author>
		<updated>2011-06-24T08:35:53-04:00</updated>

		<published>2011-06-24T08:35:53-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97085#p97085</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97085#p97085"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97085#p97085"><![CDATA[
yes, after 5 minutes or a certain period of time, The counter should reset to 0, It's not necessary 5 minutes, but there should be a time for the counter to reset?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8567">samhain</a> — Fri Jun 24, 2011 8:35 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-06-24T04:14:43-04:00</updated>

		<published>2011-06-24T04:14:43-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97081#p97081</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97081#p97081"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97081#p97081"><![CDATA[
What after those 5 minutes? (when counter will be set to 0 and other than 0)<br>It is to make but it will complicate the whole script, why you didn't say this before?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Fri Jun 24, 2011 4:14 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[samhain]]></name></author>
		<updated>2011-06-24T02:29:34-04:00</updated>

		<published>2011-06-24T02:29:34-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97079#p97079</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97079#p97079"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97079#p97079"><![CDATA[
can you make it as The voting when begins, It should last for 5 minutes, and in those 5 minutes a user can only vote once, Yes or No (one of them).<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8567">samhain</a> — Fri Jun 24, 2011 2:29 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-06-23T10:27:56-04:00</updated>

		<published>2011-06-23T10:27:56-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97076#p97076</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97076#p97076"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97076#p97076"><![CDATA[
this is proper situation because when user gets 0 votes, script removes its record from DB and when you voting again (from 0) it starts counting from the beginning<br><br>should I change it somehow for ya?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Thu Jun 23, 2011 10:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[samhain]]></name></author>
		<updated>2011-06-23T07:13:02-04:00</updated>

		<published>2011-06-23T07:13:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97075#p97075</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97075#p97075"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97075#p97075"><![CDATA[
<blockquote class="uncited"><div>&lt;Hawk375&gt; !vote Hawk375 yes<br>&lt;@BallotBox&gt; Hawk375 voted Hawk375 Yes. (1) Votes.<br>&lt;Hawk375&gt; !vote Hawk375 yes<br>&lt;Hawk375&gt; !vote Hawk375 no<br>&lt;@Flubber&gt; !vote Hawk375 no<br>&lt;@BallotBox&gt; Flubber voted Hawk375 No. (0) Votes.<br>&lt;@Flubber&gt; !vote Hawk375 yes<br>&lt;@BallotBox&gt; Flubber voted Hawk375 Yes. (1) Votes.<br>&lt;Hawk375&gt; !vote Hawk375 yes<br>&lt;@BallotBox&gt; Hawk375 voted Hawk375 Yes. (2) Votes.<br>&lt;Hawk375&gt; !vote Hawk375 yes<br>&lt;Hawk375&gt; !vote Hawk375 yes</div></blockquote>everything is fine, except Flubber votes twice, he says yes and no both. and same goes for me, after some time I was able to twice.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8567">samhain</a> — Thu Jun 23, 2011 7:13 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-06-23T05:46:02-04:00</updated>

		<published>2011-06-23T05:46:02-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97074#p97074</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97074#p97074"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97074#p97074"><![CDATA[
not multichannel yet, but the rest should work OK, please try it:<div class="codebox"><p>Code: </p><pre><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 votesset vote_limit 3# script messagesset vote_msg(is_bot) "Can't touch this!"set vote_msg(is_op) "Can't touch this!"set vote_msg(twice_on_same_user) "You can't vote twice on the same user!"set vote_msg(not_on_chan) "Wrong user name!"set vote_msg(help) "use: !vote &lt;user&gt; &lt;yes/no&gt;"set vote_msg(noone_voted) "No one voted for this user before!"# kick messagesset kick_msgs {"Come and get some!""No pain, no pain!""I'm your father Luke!""Hail to the king baby!"}# punish method# 0 - just kick# 1 - kick &amp; banset punish 1# ban type # 1)  *!*@*.domain.com # 2)  *!*@some.domain.com # 3)  *nick*!*@some.domain.com # 4)  *!*ident*@some.domain.comset bantype  4# file with users dataset users_file "users.db"###############################################################################################bind pub -|- !vote vote_procsetudef flag voteif {![file exists $users_file]} {                                                                             set file_handle [open $users_file w]close $file_handle}proc get_hosts { } { global users_fileset get_hosts [open $users_file r] set get_all [split [read $get_hosts] "\n"] close $get_hosts return $get_all }proc put_host { user_host voter_host } {global users_fileset put_host [open $users_file a] puts $put_host "$user_host 1 $voter_host" close $put_host}proc del_host { user_host } {global users_fileset old_hosts [get_hosts]set del_hosts [open $users_file w]foreach del_host $old_hosts {if {$del_host != ""} {set del_rows [split $del_host " "]set del_user_host [lindex $del_rows 0]set del_user_counter [lindex $del_rows 1]set del_user_voters [lindex $del_rows 2]if {$del_user_host != $user_host} {puts $del_hosts "$del_user_host $del_user_counter $del_user_voters"}}}close $del_hosts}proc add_del_voter { user_host voter_host action } {global users_fileset old_db [get_hosts]set add_voter [open $users_file w]foreach old_host $old_db {if {$old_host != ""} {set old_rows [split $old_host " "]set old_user_host [lindex $old_rows 0]set old_user_counter [lindex $old_rows 1]set old_user_voters [lindex $old_rows 2]if {$old_user_host == $user_host} {if {$action == "add"} {puts $add_voter "$old_user_host [expr $old_user_counter + 1] $old_user_voters\,$voter_host"} elseif {$action == "del"} {if {$old_user_counter &gt; 1} {puts $add_voter "$old_user_host [expr $old_user_counter - 1] $old_user_voters\,$voter_host"}}} {puts $add_voter "$old_user_host $old_user_counter $old_user_voters"}}}close $add_voter}proc count_voters { user_host } {set voters_count 0foreach db_host [get_hosts] {if {$db_host != ""} {set db_rows [split $db_host " "]set db_user_host [lindex $db_host 0]set db_user_counter [lindex $db_host 1]if {$db_user_host == $user_host} {set voters_count $db_user_counterbreak}}}return $voters_count}proc check_user_host { user_host } {set host_exists "no"foreach host [get_hosts] { if {$host != ""} { set rows [split $host " "]set file_user_host [lindex $rows 0]if {$file_user_host == $user_host} {set host_exists "yes"break}}}return $host_exists}proc check_voter_host { user_host voter_host } {set voter_exists "no"foreach voter [get_hosts] {if {$voter != ""} {set voter_rows [split $voter " "]set voter_user_host [lindex $voter_rows 0]set voter_voters [lindex $voter_rows 2]if {$voter_user_host == $user_host} {set host_votes [split $voter_voters ","]foreach vote $host_votes {if {$vote != ""} {if {$vote == $voter_host} {set voter_exists "yes"break}}}}}}return $voter_exists}proc vote_proc { nick uhost hand chan arg } {global users_file vote_limit kick_msgs punish vote_msgset args [split $arg] set user [lindex $args 0] set yes_or_no [lindex $args 1]if {![channel get $chan vote]} { return                                                                                          }if {$user != ""} {if {[isbotnick $user]} {putquick "PRIVMSG $nick :$vote_msg(is_bot)"return}if {[isop $user $chan]} {putquick "PRIVMSG $nick :$vote_msg(is_op)"return}if {![onchan $user $chan]} {putquick "PRIVMSG $nick :$vote_msg(not_on_chan)"return}if {($yes_or_no == "yes") || ($yes_or_no == "no")} { set user_host [getchanhost $user $chan]if {$yes_or_no == "yes"} {if {[check_user_host $user_host] == "yes"} {if {[check_voter_host $user_host $uhost] == "no"} {set user_votes_counter [count_voters $user_host]if {[expr $user_votes_counter + 1] == $vote_limit} {putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes."del_host $user_hostif {$punish == 1} {putquick "MODE $chan +b [ban_mask $uhost $nick]" }putkick $chan $user [lindex $kick_msgs [expr {int(rand() * [llength $kick_msgs])}]]} {putquick "PRIVMSG $chan :$nick voted $user Yes. ([expr $user_votes_counter + 1]) Votes."add_del_voter $user_host $uhost "add"}} {putquick "PRIVMSG $nick :$vote_msg(twice_on_same_user)"}} {putquick "PRIVMSG $chan :$nick voted $user Yes. (1) Votes."put_host $user_host $uhost}} elseif {$yes_or_no == "no"} {if {[check_user_host $user_host] == "yes"} {if {[check_voter_host $user_host $uhost] == "no"} {set user_votes_counter [count_voters $user_host]if {[expr $user_votes_counter - 1] == 0} {putquick "PRIVMSG $chan :$nick voted $user No. (0) Votes."} {putquick "PRIVMSG $chan :$nick voted $user No. ([expr $user_votes_counter - 1]) Votes."}add_del_voter $user_host $uhost "del"} {putquick "PRIVMSG $nick :$vote_msg(twice_on_same_user)"}} {putquick "PRIVMSG $nick :$vote_msg(noone_voted)"}}} {putquick "PRIVMSG $nick :$vote_msg(help)"}} {putquick "PRIVMSG $nick :$vote_msg(help)"}}proc ban_mask { host nick } {global bantypeswitch -- $bantype {1 {set bmask "*!*@[lindex [split [maskhost $host] "@"] 1]"}2 {set bmask "*!*@[lindex [split $host @] 1]"}3 {set bmask "*$nick*!*@[lindex [split $host "@"] 1]"}                4 {set bmask "*!*[lindex [split $host "@"] 0]*@[lindex [split $host "@"] 1]"}return $bmask}}putlog "simple-vote.tcl ver 0.1 by tomekk loaded"</code></pre></div><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Thu Jun 23, 2011 5:46 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[samhain]]></name></author>
		<updated>2011-06-23T03:02:14-04:00</updated>

		<published>2011-06-23T03:02:14-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97073#p97073</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97073#p97073"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97073#p97073"><![CDATA[
&lt;@Hawk&gt; !vote Ompahpah yes<br>&lt;@BallotBox&gt; Hawk voted Ompahpah Yes. (1) Votes.<br>&lt;@Hawk&gt; !vote Ompahpah yes<br>&lt;@Hawk&gt; !vote Ompahpah yes<br>-&gt; [Flubber] CHAT<br>&lt;@Flubber&gt; !vote Ompahpah yes<br>&lt;@BallotBox&gt; Flubber voted Ompahpah Yes. (2) Votes.<br>&lt;@Flubber&gt; !vote Ompahpah yes<br>-&gt; [Ompahpah] CHAT<br>* timur` (<a href="mailto:fu@cpe-72-229-42-81.nyc.res.rr.com">fu@cpe-72-229-42-81.nyc.res.rr.com</a>) has joined #BotHelp<br>&lt;@Hawk&gt; timur` type !vote Ompahpah yes<br>&lt;timur`&gt; salam<br>&lt;@Hawk&gt; ws<br>&lt;timur`&gt; !vote Ompahpah yes<br>&lt;@BallotBox&gt; timur` voted Ompahpah Yes. (3) Votes.<br>* Ompahpah was kicked by BallotBox (message N)<br>* Ompahpah (<a href="mailto:usa@chick-mag.net">usa@chick-mag.net</a>) has joined #BotHelp<br>&lt;@Hawk&gt; good<br>&lt;@Hawk&gt; !vote timur` yes<br>&lt;@BallotBox&gt; Hawk voted timur` Yes. (1) Votes.<br>&lt;timur`&gt; testing a new bot?<br>&lt;@Hawk&gt; yeah a new script<br>&lt;timur`&gt; cool<br>&lt;@BallotBox&gt; !vote timur` yes<br>&lt;@Flubber&gt; !vote timur` yes<br>&lt;@BallotBox&gt; Flubber voted timur` Yes. (2) Votes.<br>&lt;@Hawk&gt; timur` type !vote timur` yes<br>&lt;timur`&gt; you should make the vote-annoucements in a different color, like the rule8 bot<br>&lt;timur`&gt; does<br>&lt;timur`&gt; in AP<br>&lt;timur`&gt; that way it's noticeable in scroll<br>&lt;@Hawk&gt; yeah For the time being I am only testing the script counting<br>&lt;@Hawk&gt; timur` type !vote timur` yes<br>&lt;timur`&gt; !vote timur` yes<br>&lt;@BallotBox&gt; timur` voted timur` Yes. (3) Votes.<br>* timur` was kicked by BallotBox (message 2)<br>&lt;@Hawk&gt; hehe good<br><br><br>The script works good so far on Yes <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"> and I reduced the counting to 3, so it's good at the moment, Nice work tommek =)<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8567">samhain</a> — Thu Jun 23, 2011 3:02 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-06-22T06:27:55-04:00</updated>

		<published>2011-06-22T06:27:55-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97068#p97068</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97068#p97068"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97068#p97068"><![CDATA[
oke, please try this script - its unfinished but counting should work:<div class="codebox"><p>Code: </p><pre><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 votesset vote_limit 5# dir with users dataset users_file "users.db"# kick messagesset kick_msgs {"message 1""message 2""message 3""message N"}# punish method# 0 - just kick# 1 - kick &amp; banset punish 0###############################################################################################bind pub -|- !vote vote_procsetudef flag voteif {![file exists $users_file]} {                                                                             set file_handle [open $users_file w]close $file_handle}proc get_hosts { } { global users_fileset get_hosts [open $users_file r] set get_all [split [read $get_hosts] "\n"] close $get_hosts return $get_all }proc put_host { user_host voter_host } {global users_fileset put_host [open $users_file a] puts $put_host "$user_host $voter_host" close $put_host}proc del_host { user_host } {global users_fileset old_hosts [get_hosts]set del_hosts [open $users_file w]foreach del_host $old_hosts {if {$del_host != ""} {set del_rows [split $del_host " "]set del_user_host [lindex $del_rows 0]set del_user_voters [lindex $del_rows 1]if {$del_user_host != $user_host} {puts $del_hosts "$del_user_host $del_user_voters"}}}close $del_hosts}proc add_voter { user_host voter_host } {global users_fileset old_db [get_hosts]set add_voter [open $users_file w]foreach old_host $old_db {if {$old_host != ""} {set old_rows [split $old_host " "]set old_user_host [lindex $old_rows 0]set old_user_voters [lindex $old_rows 1]if {$old_user_host == $user_host} {puts $add_voter "$old_user_host $old_user_voters\,$voter_host"} {puts $add_voter "$old_user_host $old_user_voters"}}}close $add_voter}proc count_voters { user_host } {set voters_count 0foreach db_host [get_hosts] {if {$db_host != ""} {set db_rows [split $db_host " "]set db_user_host [lindex $db_host 0]set db_user_voters [lindex $db_host 1]if {$db_user_host == $user_host} {set voters_split [split $db_user_voters ","]set voters_count [llength $voters_split]break}}}return $voters_count}proc check_user_host { user_host } {set host_exists "no"foreach host [get_hosts] { if {$host != ""} { set rows [split $host " "]set file_user_host [lindex $rows 0]if {$file_user_host == $user_host} {set host_exists "yes"break}}}return $host_exists}proc check_voter_host { user_host voter_host } {set voter_exists "no"foreach voter [get_hosts] {if {$voter != ""} {set voter_rows [split $voter " "]set voter_user_host [lindex $voter_rows 0]set voter_voters [lindex $voter_rows 1]if {$voter_user_host == $user_host} {set host_votes [split $voter_voters ","]foreach vote $host_votes {if {$vote != ""} {if {$vote == $voter_host} {set voter_exists "yes"break}}}}}}return $voter_exists}proc vote_proc { nick uhost hand chan arg } {global users_file vote_limit kick_msgs punishset args [split $arg] set user [lindex $args 0] set yes_or_no [lindex $args 1]if {[isbotnick $user]} { return }if {$user != ""} {if {($yes_or_no == "yes") || ($yes_or_no == "no")} { if {[onchan $user $chan]} { set user_host [getchanhost $user $chan]if {[check_user_host $user_host] == "yes"} {if {[check_voter_host $user_host $uhost] == "no"} {set user_votes_counter [count_voters $user_host]if {[expr $user_votes_counter + 1] == $vote_limit} {putquick "PRIVMSG $chan :$nick voted $user Yes. ($vote_limit) Votes."if {$punish == 1} {putquick "MODE $chan +b *!*$user_host" }putkick $chan $user [lindex $kick_msgs [expr {int(rand() * [llength $kick_msgs])}]]del_host $user_host} {putquick "PRIVMSG $chan :$nick voted $user Yes. ([expr $user_votes_counter + 1]) Votes."add_voter $user_host $uhost}}} {put_host $user_host $uhostputquick "PRIVMSG $chan :$nick voted $user Yes. (1) Votes."}}}}}putlog "simple-vote.tcl ver 0.1 by tomekk loaded"</code></pre></div>multichannel support, various messages later, "no" will be later..<br>you can vote only for YES atm, I just want to try the counting on your channel<br><br>cheers<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Wed Jun 22, 2011 6:27 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-06-22T05:16:29-04:00</updated>

		<published>2011-06-22T05:16:29-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97066#p97066</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97066#p97066"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97066#p97066"><![CDATA[
Yeah, its working OK for me.<br>I think I have to rewrite it .. I mean change the style of saving users info.<br>But I need time for it and again testing, eh.<br><br>I will try to do that ASAP <img class="smilies" src="https://forum.eggheads.org/images/smilies/icon_smile.gif" width="15" height="15" alt=":)" title="Smile"><p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Wed Jun 22, 2011 5:16 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[samhain]]></name></author>
		<updated>2011-06-21T05:07:58-04:00</updated>

		<published>2011-06-21T05:07:58-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=97050#p97050</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=97050#p97050"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=97050#p97050"><![CDATA[
does the script work fine for you?<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8567">samhain</a> — Tue Jun 21, 2011 5:07 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[tomekk]]></name></author>
		<updated>2011-06-03T05:44:37-04:00</updated>

		<published>2011-06-03T05:44:37-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96964#p96964</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96964#p96964"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96964#p96964"><![CDATA[
hard to write something cause this script is working on my eggy i see the files inside, hmm<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=10332">tomekk</a> — Fri Jun 03, 2011 5:44 am</p><hr />
]]></content>
	</entry>
		<entry>
		<author><name><![CDATA[samhain]]></name></author>
		<updated>2011-05-29T01:41:04-04:00</updated>

		<published>2011-05-29T01:41:04-04:00</published>
		<id>https://forum.eggheads.org/viewtopic.php?p=96949#p96949</id>
		<link href="https://forum.eggheads.org/viewtopic.php?p=96949#p96949"/>
		<title type="html"><![CDATA[Voting script (very needed)]]></title>

		
		<content type="html" xml:base="https://forum.eggheads.org/viewtopic.php?p=96949#p96949"><![CDATA[
anyone? can anyone please fix this bug and make this script working, tomek has made efforts to create it.<p>Statistics: Posted by <a href="https://forum.eggheads.org/memberlist.php?mode=viewprofile&amp;u=8567">samhain</a> — Sun May 29, 2011 1:41 am</p><hr />
]]></content>
	</entry>
	</feed>
