Jump to content
chain

Advanced voting system

Recommended Posts

  • Administrators

Well, people DID make votekick snippets, but I decided to post my own :x

Well this one is a bit more advanced. There is no !votekick, there is just !vote kick. Now the difference is that !votekick is one command, while !vote kick can be changed to !vote ban, etc. so there is one command, but more functions. I hope you understand. For now there is only kick.

REQUIREMENTS:
-You must be an OP (if you're not, the vote will be cancelled)
-The nick you specify MUST be in a channel (if not, it will be automaticly cancelled)
-You can't call a vote from ANY channel until one vote ends. (Example you call the vote from #engineers and someone else calls a vote from #nexus and for #nexus it says that a vote is underway in #engineers)
-You can vote with !pgup and !pgdn

Well, I tried to make the code clean. As you can see you can modify the code so there is an option for kickban too.

Well, you might see that I'm not THAT great with coding. This code will be updates as I add more features and functions. This is some sort of an alpha stage. For future plans I am planning on adding cancelling votes, changing votes from yes to no, customizing vote time (I wanted to do that, but variabled messed me up) and of course, more functions like mute (requires +m, if user rejoins he will be automaticly devoiced), kickban (customize your own time up to the time the OP allows).

 

set %voteon2 off

on *:TEXT:!vote*:#: {
if ($2 == $null) || ($3 == $null) || ($2 != kick) {
/msg $chan Incorrect usage.
halt
}

if ($me isop $chan) { }
else {
/msg $chan I am not an OP here.
halt
}


if ($3 ison $chan) { }
else {
/msg $chan $3 is not in $chan
halt
}

if (%voteon2 == off) { }
elseif (%voteon2 == on) {
/msg $chan There is already a vote called in %chanvote
halt
}

if ($3 isop $chan) {
/msg $chan $3 is an OP.
halt
}

set %voteon2 on
set %votetype $2
set %votename $3
/callvote
}

alias -l callvote {
if (%votetype == kick) {
/votekick
halt
}
}

alias -l votekick {
set %chanvote $chan
msg $chan $nick has called a vote to kick %votename . You have 15 seconds to vote.
/timer 1 15 voteresult
}

alias -l voteresult {
if (%voteon2 == off) {
set %voteon2 0
set %vyes 0
set %vno 0
unset %voted
halt }

if (%vyes > %vno) {
/msg %chanvote Vote passed!
kick %chanvote %votename Vote passed.
}
else {
/msg %chanvote Vote failed!
}
/timer 1 2 /msg %chanvote Results: %vyes people voted yes; %vno people voted no
set %voteon2 off
set %vyes 0
set %vno 0
unset %voted
}

on *:TEXT:!pgup*:#: {
if (%voteon2 == off) {
/msg $chan There is nothing to vote for.
halt
}


if ($istok(%voted,$address,32)) {
notice $nick You have already voted.
halt
}


/msg $chan $nick votes yes
inc %vyes 1
%voted = $addtok(%voted,$address,32)
}

on *:TEXT:!pgdn*:#: {
if (%voteon2 == off) {
/msg $chan There is nothing to vote for.
halt
}

if ($istok(%voted,$address,32)) {
notice $nick You have already voted.
halt
}


/msg $chan $nick votes no
inc %vno 1
%voted = $addtok(%voted,$address,32)
}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...