a user types !voteban and the others say !yes/!no as to whether they want that person banned. The vote runs for 30sec and needs a minimum of 4 votes to run.
There is protection so that people cant vote for themselves and people cant vote twice. An op on the channel can do !end to cancel the vote. It will also work if the user changes their name before the end of the vote.
I am fairly new to scripting so be critical, tell me what u think
Paste code into remotes, then restart your IRC
;Commands:
;!voteban <nick> - sets a user to be votebanned
;!yes/no - register your vote
;[admin] [+o]
;!voteon - turns the voting system ON
;!voteoff - turns the voting system OFF
;!end - Cancels the current vote!
on 1:CONNECT: { IF (!%votechan) {
set %mixchan #$?"Please specify the channel to run votes.."
}
set %banyes 0
set %banno 0
unset %votenick
set %votes 0
set %voting 1
set %voteban 0
set %voted blank
}
on 1:NICK: { IF ($nick == %votenick) { set %votenick $newnick } }
on 1:TEXT:!end:%votechan: { IF ($nick isop $chan) {
msg $chan 14,1Vote ended by an admin!
timer99 off
set %banyes 0
set %banno 0
unset %votenick
set %votes 0
set %voteban 0
set %voted blank
}
}
on 1:TEXT:!voteban:%votechan: msg $chan 14,1Please specify a nickname to vote!
on 1:TEXT:!voteon:%votechan:{ If ($nick isop $chan) { set %voting 1 | msg $chan 14,1Voting 9ON } }
on 1:TEXT:!voteoff:%votechan: { If ($nick isop $chan) { set %voting 0 | msg $chan 14,1Voting 4OFF } }
on 1:TEXT:!voteban *:%votechan: { IF (%voting == 1) {
IF (%voteban == 0) && ($2 != $null) && ($2 ison $chan) && ($2 != $nick) && ($2 != $me) {
set %voteban 1
msg $chan 14,1VoteBan Nick:15 $2 14[Vote: 15!yes14 /15 !no14] 15[14 $+ 4 total votes needed to voteban15]
set %votenick $2
timer99 1 30 votebanend
}
else { IF (%voteban == 1) {
msg $chan 14,1Vote already started! Nick:15 %votenick }
elseif ($2 == $null) { msg $chan 14,1Please specify a nickname to vote! }
elseif ($2 !ison $chan) { msg $chan 14,1Please pick a nickname on this channel?! }
elseif ($2 == $nick) { msg $chan 14,1You cannot ban yourself }
elseif ($2 == $me) { kick $chan $nick Dont try ban me? }
}
}
else msg $chan 14,1Voting is 4DISABLED!
}
alias votebanend {
set %votes %banno + %banyes
IF (%votes > 3) {
IF (%banyes > %banno) {
msg %votechan 15,1YES14 has won the vote with15 %banyes 14votes over15 %banno 14votes!15 Banning %votenick | ban -ku300 %votechan %votenick Temporary ban: 5mins }
elseif (%banno > %banyes) {
msg %votechan 15,1NO14 has won the vote with15 %banno 14votes over15 %banyes 14votes!15 %votenick Stays }
elseif (%yes == %no) {
msg %votechan 15,1DRAW,14 This vote was a draw, Yes:15 %banyes 14No:15 %banno $+ . %votenick stays! }
set %banyes 0
set %banno 0
unset %votenick
set %votes 0
set %voteban 0
set %voted blank
}
else {
msg %votechan 14,1Not enough votes. Total:15 %votes 14Votes needed:15 4
set %banyes 0
set %banno 0
unset %votenick
set %votes 0
set %voteban 0
set %voted blank
}
}
on 1:TEXT:!yes:%votechan: { IF ($nick != %votenick) {
IF (%voteban == 1) {
IF ($matchtok(%voted,$address($nick,1),0,32) == 0) {
inc %banyes
notice $nick [!YES] Vote Counted
/set %voted %voted $address($nick,1)
}
else notice $nick Already voted
}
else notice $nick No vote started?
}
else notice $nick You cannot vote for yourself u plonker?!
}
on 1:TEXT:!no:%votechan: { IF ($nick != %votenick) {
IF (%voteban == 1) {
IF ($matchtok(%voted,$address($nick,1),0,32) == 0) {
inc %banno
notice $nick [!NO] Vote Counted
/set %voted %voted $address($nick,1)
}
else notice $nick Already voted
}
else notice $nick No vote started?
}
else notice $nick You cannot vote for yourself plonker?!
}
I got this working. Thank you