!voteban

By LikWydd on Jul 18, 2006

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?!
}

Comments

Sign in to comment.
A*1*T*E*A*M   -  Feb 14, 2007

same author say because its didnt work

 Respond  
A*1*T*E*A*M   -  Feb 14, 2007

yeah I know

 Respond  
APinis   -  Feb 14, 2007

this doesn`t work.

 Respond  
A*1*T*E*A*M   -  Feb 14, 2007

You can create your own script ... not Noutrious to made a script for you:)

 Respond  
A*1*T*E*A*M   -  Feb 14, 2007

Noutrious, hello!
That script does not work and I saw that you have made some coments about that. I need that script for fun and I tried to fixed but I did not. May you maked for me, pls! Thanks a lot!
Real_man


LOL LOL LOL LOL

 Respond  
real_man   -  Jan 09, 2007

Noutrious, hello!
That script does not work and I saw that you have made some coments about that. I need that script for fun and I tried to fixed but I did not. May you maked for me, pls! Thanks a lot!
Real_man

 Respond  
Noutrious   -  Jul 19, 2006

I see, that this snippet could be 2x shorter, and you miss some brackets.

Blood_Wolf89  -  Mar 27, 2015

I got this working. Thank you

Sign in to comment

Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.