To start of with, this is my first script, so it isn't optimized.
I'm trying to make a sort of First Death, betting system. Where if open, the person could bet on what boss or what exactly could kill me.

Commands:
!fd open
Opens first death "event"
!firstdeath*
Records $2 and $nick into an .ini file
!fd close
Closes bets
!fd*
Declares what killed me and gives points to whoever guess right.

The problem is that it will only add points to the person who typed !fd* (I.E. a moderator) and not for everyone who bet. Is there anyway to make it check every line instead of just one?

Code:
on *:TEXT:!fd open:#:{
  if ($nick isop #) {
    if (%firstdeath == 0) {
      msg $chan First death is open, chose the form of death!
      set %firstdeath 1
      write -c Firstdeath.ini
    }
    else {
      msg $chan First Death is already open. 
    }
  }
  else {
    msg $chan This command is for Mods only.
  }
}

on *:TEXT:!fd close:#:{
  if ($nick isop #) {
    if (%firstdeath == 1) {
      msg $chan First death is now closed.
      set %firstdeath 3
    }
    else {
      msg &chan First Death bets are not open. 
    }
  }
  else {
    msg $chan This command is for Mods only.
  }
}

on *:TEXT:!firstdeath*:#:{
  if (%firstdeath == 1) {
    var %boss = $2
    writeini Firstdeath.ini $nick Boss $2
    msg $chan $nick You chose $readini(Firstdeath.ini, $nick, Boss)
  }
  else {
    msg $chan First death has already been claimed, but bets are still open. 
  }
}

on *:TEXT:!fd*:#:{
  if ($nick isop #) {
    if (%firstdeath == 3) {
      if ($readini(Firstdeath.ini, $nick, Boss) == $2) {
        msg $chan YOU WIN!
        set %firstdeath 0
        writeini -n Dinocoins.ini $+(#,.,$nick) dinocoins $calc($readini(Dinocoins.ini,$+(#,.,$nick),dinocoins) + 50)
        msg $chan $nick now has $readini(Dinocoins.ini,$+(#,.,$nick),dinocoins) Dino coins.
        write -c Firstdeath.ini
      } 
      else {
        msg $chan $nick Sorry
        msg $chan Winning boss is $2
      }
    }
    else {
      msg $chan You must close First Death first. 
    }
  }
  else {
    msg $chan This command is for Mods only
  }
}

Last edited by Newbie; 24/11/14 03:30 PM.