mIRC Homepage

giveaway script

Posted By: judge2020

giveaway script - 28/04/14 12:49 PM

i am trying to make a giveaway script and my current code is this
Code:
on *:TEXT:!giveaway enter:#:{
  if (%giveaway == on) {
    if (!$read(giveaway.txt,nw,$nick)) {
      write giveaway.txt $nick
      msg $chan $nick - you have been entered into the giveaway! 
    }
  }
  elseif (%giveaway == off) {
    msg $chan There is no active giveaway
  }
}
on *:TEXT:!giveaway start:#:{
  var %giveaway = on
  { msg $chan giveaway started. please do "!giveaway enter" to enter. To clear all names, please do "!giveaway done" }
}
on *:TEXT:!giveaway end:#:{
  var %giveaway = off
  { msg $chan Giveaway has ended. please do !draw to pick a winner!" }
}
on *:text:!giveaway done:#:{
  var %giveaway = off
  { msg $chan giveaway is complete. erasing all names from the giveaway }
  write $+(-ds,1) giveaway.txt
}
on *:text:!draw:#:{ 
  if (%giveaway == off) { msg $chan The winner is $read(giveaway.txt) $+ !! If you would like to pick another winner draw again. }
  elseif (%giveaway == on) { msg $chan The giveaway is still on! please do "!giveaway end" }
}


The thing is i can't get "!giveaway done" to erase all the line of the file, and when i type !draw it doesn't do anything (i suspect the variables aren't working right) Please help
Posted By: blessing

Re: giveaway script - 28/04/14 01:23 PM

You have to use set %giveaway instead of var %giveaway to make !draw work.
Code:
on *:TEXT:!giveaway start:#:{
  set -e %giveaway on

on *:TEXT:!giveaway end:#:{
  set -e %giveaway off

...

write $+(-ds,1) giveaway.txt will clear the line that contains 1 in that line.
To clear giveaway.txt, use write -c giveaway.txt.
Posted By: Dunsparth

Re: giveaway script - 29/04/14 01:36 AM

Im trying to use this script and it's not working at all for me, i'm typing !giveaway start and nothing.
© 2022 mIRC Discussion Forums