All pastes #923587 Raw Edit

Someone

public text v1 · immutable
#923587 ·published 2008-02-29 17:59 UTC
rendered paste body
-PAGE 3-

POLL SCRIPT ONLY


On $*:text:/^[!@]setpoll/Si:#Jolly,#dkthunder,#dtchat:{
  if (%dtpoll == $Null) {
    If ($3 == or) {
      set %dtpoll $2-
      msg #dkthunder $s1(DarkThunder's Poll set to) $s2(" $+ %dtpoll $+ ?") 
      msg #dkthunder $s1(Please vote in this poll by either typing) $s3(" $+ $2 $+ ") $s1(or) $s4(" $+ $4 $+ ")
      set %answer1 $2
      Set %answer2 $4
    set %pollt1 }
    elseif ($3 !== or) {
      Set %dtpoll $2-
      msg #dkthunder $s1(DarkThunder's Poll set to) $s2(" $+ %dtpoll $+ ?") 
      msg #dkthunder $s1(Please vote in this poll by either typing) $s3("!Yes") $s1(or) $s4("!No")
      set %answer1 !Yes
      set %answer2 !No
    set %pollt2 }
  }
  elseif (%dtpoll !== $null) {
    notice $nick $s1(Sorry there is already a poll set) $s2(Type !delpoll to remove the old poll)
  }
}

On $*:text:/^[!@]poll/Si:#Jolly,#dkthunder,#dtchat:{
  if (%dtpoll == $Null) {
  Notice $nick $s1(DarkThunder currently has no poll set, to set one type) $s2(!setpoll.) }
  elseIf {%dtpoll !== $null) {
    Set %msgstyle.poll $iif($left($1,1) = @,msg #,notice $nick)
  %msgstyle.poll $s1(DarkThunder's current poll is) $s2(" $+ %dtpoll $+ ?") }
}

On $*:text:/^[!@](scores|results)/Si:#Jolly,#dkthunder,#dtchat:{
  if (%dtpoll == $Null) {
  Notice $nick $s1(DarkThunder currently has no poll set, to set one type) $s2(!setpoll.) }
  elseIf {%dtpoll !== $null) {
    Set %msgstyle.poll $iif($left($1,1) = @,msg #,notice $nick)
    %msgstyle.poll $s1(DarkThunder's current poll is) $s2(" $+ %dtpoll $+ ?") 
    If (%dtpollscore1 == $null) { Set %dtpollscore1 0 }
    If (%dtpollscore2 == $null) { Set %dtpollscore2 0 }
    %msgstyle.poll $s1(Scores for) $s3(%answer1) $s2(%dtpollscore1) 
  %msgstyle.poll $s1(Scores for) $s4(%answer2) $s2(%dtpollscore2) }
}

	
On $*:text:/^[!@]delpoll/Si:#Jolly,#dkthunder,#dtchat:{
  inc %s
  if ($nick isop $chan) || ($nick ishop $chan) {
    If (%dtpollscore1 == $null) { Set %dtpollscore1 0 }
    If (%dtpollscore2 == $null) { Set %dtpollscore2 0 }
    msg #dkthunder $s1(The poll has been removed, by request from) $s2($nick $+ .) 
    msg #dkthunder $s1(Scores for) $s3(%answer1) $s2(%dtpollscore1)
    msg #dkthunder $s1(Scores for) $s4(%answer2) $s2(%dtpollscore2)
    unset %dtpoll 
    unset %answer1
    unset %answer2
    unset %dtpollscore1
    unset %dtpollscore2 
  remini poll.ini $chan  }
  elseif ($nick isreg $chan) || ($nick isvoice $chan) {
  notice $nick $s1(Sorry) $s2($nick $+ ,) $s1(you do not have the power to do that.) }
}



On *:text:*:#Jolly,#dkthunder,#dtchat:{
  If (%dtpoll !== $Null) && ($readini(poll.ini,$chan,$address($nick,2)) == Voted ) {
    If ($1 == %answer1) || ($1 == %answer2) {
    Notice $nick $s1(You have aleady voted!) $s2(To view the scores type !scores) | HALT }
  }
  elseIf (%dtpoll !== $Null) && ($readini(poll.ini,$chan,$address($nick,2)) !== Voted ) {
    If ($1 == %answer1) || ($1 == %answer2) {
      Notice $nick $s1(You have voted) $s2($1 $+ !)  
      Notice $nick $s1(To view the current results type) $s2(!scores.)
    timer 1 1 writeini poll.ini $chan $address($nick,2) Voted }
    If ($1 == %answer1) && ($readini(poll.ini,$chan,$address($nick,2)) !== Voted ) {
    set %dtpollscore1 $calc( %dtpollscore1 + 1 ) }
    elseif ($1 == %answer2) && ($readini(poll.ini,$chan,$address($nick,2)) !== Voted )  {
    set %dtpollscore2 $calc( %dtpollscore2 + 1 ) }  
  }
}