All pastes #416793 Raw Edit

Saibal

public text v1 · immutable
#416793 ·published 2007-03-30 13:50 UTC
rendered paste body
;# VoteSYS Script v1.0                               #
;# by: Saibal                                        #
;# email: messedupkid@gmail.com                        #
;#####################################################
;# HELP System can be showed by !votehelp trigger ;) #
;#####################################################

on *:text:!voteon*:#: {
  if (%vote) { kte_echo -a There's already a vote in progress | return }
  if (!$server) { kte_echo -a Not connected. | return }
  if ($active == Status Window) { kte_echo -a Not in a status window. | return }
  set %votechan #
  set %vote $mid($1-,9,$len($1-) - 9)
  if (!%vote) { halt }
  else {
    set %yes 0
    set %no 0
    set %dunno 0
    set %voteby $nick
    msg %votechan ----------------------------
    msg %votechan 8,4Q:  $+ %vote $+ 
    msg %votechan Time to VOTE!
    msg %votechan (vote with !yes and !no and !dunno)
    msg %votechan ----------------------------
    set %voting til
  }
}
on *:text:!voteoff:#: {
  if ($nick != %voteby) { msg %votechan You don't have a permission to stop this vote. It could be done by 8,1 %voteby  only! | return }

  msg %votechan ----------------------------
  msg %votechan Vote is OVER!
  msg %votechan 8,4Q:  $+ %vote $+ 
  msg %votechan Results: YES-> %yes ( $+ $calc(%yes / $calc(%yes + %no + %dunno) * 100) $+ % $+ ) .. NO-> %no ( $+ $calc(%no / $calc(%yes + %no + %dunno) * 100) $+ % $+ ) .. DUNNO-> %dunno ( $+ $calc(%dunno / $calc(%yes + %no + %dunno) * 100) $+ % $+ )

  msg %votechan Voters: $iif(%voters,%voters,N/A)
  if (!%no && !%yes && !%dunno) { msg %votechan 8,1FINAL RESULT: no one voted... }
  elseif (%no < %dunno && %yes < %dunno) { msg %votechan 8,1FINAL RESULT: DunNO! }
  elseif (%no == %yes) { msg %votechan 8,1FINAL RESULT: Draw! }
  elseif (%no > %yes) { msg %votechan 8,1FINAL RESULT: No! }
  elseif (%no < %yes) { msg %votechan 8,1FINAL RESULT: Yes! }
  msg %votechan ----------------------------
  unset %vote* %yes %no %dunno
}
on *:text:!yes:#: {
  if (# == %votechan) && (%voting == til) {
    if ($nick isin %voters) { return }
    set %voters %voters $nick (yes)  
    /notice $nick Thx for the vote $+ !
    inc %yes 1
  }
}
on *:text:!no:#: {
  if (# == %votechan) && (%voting == til) {  
    if ($nick isin %voters) { return }
    set %voters %voters $nick (no)  
    /notice $nick Thx for the vote $+ !
    inc %no 1
  }
}
on *:text:!dunno:#: {
  if (# == %votechan) && (%voting == til) {  
    if ($nick isin %voters) { return }
    set %voters %voters $nick (dunno)  
    /notice $nick Thx for the vote $+ !
    inc %dunno 1
  }
}
on *:text:!votehelp:#: {
  /notice $nick ----------------------------
  /notice $nick  $+ 2HELP SYSTEM for VoteSYS Script v1.0 by Saibal $+ 
  /notice $nick - To start voting use !voteon <Question> trigger
  /notice $nick - To stop voting use !voteoff trigger ... NOTE: It could be done only by a user who began voting!
  /notice $nick - During voting you can use these triggers to vote: !no (for NO), !yes (for YES), !dunno (if you don't know)
  /notice $nick ----------------------------
}