Code:
on *:text:!fd &:#: {
  var %file firstdeath.ini
  if (!%firstdeath) {
    if ($2 != open) msg # First Death is currently not active, it needs to be opened first.
    elseif ($nick !isop #) msg # This command is for mods only. 
    else {
      msg # First Death is open, choose the form of first death.
      write -c %file
      set %firstdeath 1
    }
  }
  elseif (%firstdeath == 1)  {
    if ($2 != close) writeini %file $2 $nick 1
    else { 
      if ($nick !isop #) msg # This command is for mods only.
      else { 
        msg # First Death is closed.
        set %firstdeath 2
      }
    }
  }
  elseif (%firstdeath == 2) { 
    if ($nick !isop #) msg # This command is for mods only 
    else {
      var %winners $ini(%file,$2,0)
      while (%winners) {
        var %winner $ini(%file,$2,%winners)
        var %wins %wins %winner
        writeini -n Dinocoins.ini $+(#,.,%winner) dinocoins $calc($readini(Dinocoins.ini,$+(#,.,%winner),dinocoins) + 50)
        dec %winners
      }
      msg # The winners are: %wins - All received 50 dinocoins.
      unset %firstdeath
    }
  } 
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net