All pastes #78776 Raw Edit

cellkyborg

public text v1 · immutable
·published 2006-07-04 15:28 UTC
rendered paste body
on *:text:.add *:#w*: { 
  if ($2 isin %ids) && ($2 isnum 200-500) {
    var %tmp.rez $readini(rez.ini,$nick,$2)
    if (!%tmp.rez) && (%tmp.rez != 0) {
      if ($3 isnum 1-2) && ($4 isnum 1-1000) {
        writeini rez.ini $nick $2 $3 $4
        msg $nick Aciu, Jusu spejimas uzregistruotas! 
      }
      elseif ($3 == 0) {
        writeini rez.ini $nick $2 $3
        msg $nick Aciu, Jusu spejimas uzregistruotas! 
      }
      else { msg $nick Blogai ivesti duomenys! }
    }
    else { msg $nick Jus jau spejote! ID: $2 $+ , Rezultatas: %tmp.rez }
  }
  else { msg $nick Blogai ivesti duomenys! }
}

on *:text:.ids:#w*: {
  var %tmp.ch $remove(%ids,$chr(32))
  if (%tmp.ch) { 
    var %tmp 1
    var %tmp.id
    var %tmp.msg
    while (%tmp <= $numtok(%ids,32)) {
      %tmp.id = $gettok(%ids,%tmp,32)
      %tmp.msg = $replace(%tmp.msg,.,$chr(44)) $readini(ids.ini,teams,%tmp.id) ( $+ %tmp.id $+ ) $+ .
      inc %tmp 
    }
    msg $chan Galimi ID: %tmp.msg 
  }
  else { msg $chan Nera ID }
}

on *:text:.pids:#w*: {
  var %tmp.ch $remove(%pids,$chr(32))
  if (%tmp.ch) { 
    var %tmp 1
    var %tmp.id
    var %tmp.msg
    while (%tmp <= $numtok(%pids,32)) {
      %tmp.id = $gettok(%pids,%tmp,32)
      %tmp.msg = $replace(%tmp.msg,.,$chr(44)) $readini(ids.ini,teams,%tmp.id) ( $+ %tmp.id $+ ) $+ .
      inc %tmp 
    }
    msg $chan Galimi PID: %tmp.msg 
  }
  else { msg $chan Nera PID }
}

on *:text:.taskai:#w*: {
  var %tmp.points $readini(rez.ini,$nick,points)
  msg $nick $iif(%tmp.points,Tavo taskai: %tmp.points,Tu neturi tasku!)
}

on *:text:.top3:#w*: {
  var %top1 Niekas 0
  var %top2 Niekas 0
  var %top3 Niekas 0
  var %tmp 1
  var %tmp.txt, %tmp.nick, %tmp.pts
  while (%tmp <= $lines(rez.ini)) {
    %tmp.txt = $read(rez.ini,%tmp)
    if ($left(%tmp.txt,1) == [) {
      %tmp.nick = $mid(%tmp.txt,2,$calc($len(%tmp.txt)-2))
    }
    if ($left(%tmp.txt,6) == points) {
      %tmp.pts = $remove(%tmp.txt,points=)

      if (%tmp.pts > $gettok(%top1,2,32)) {
        %top3 = %top2
        %top2 = %top1
        %top1 = %tmp.nick %tmp.pts
      }
      elseif (%tmp.pts > $gettok(%top2,2,32)) {
        %top3 = %top2
        %top2 = %tmp.nick %tmp.pts
      }
      elseif (%tmp.pts > $gettok(%top3,2,32)) { %top3 = %tmp.nick %tmp.pts }
    }
    inc %tmp
  }
  msg $chan Top3: #1. %top1 $+ , #2. %top2 $+ , #3. %top3 $+ .
}

on *:text:.pradeti *:#w*: {
  if (@ $+ $nick $+ @ isin %allow.users) {
    if ($2 isnum 200-500) && ($2 isin %ids) {
      %ids = $remove(%ids,$2)
      %pids = %pids $2
      msg $chan Prasidejo rungtynes ( $+ $readini(ids.ini,teams,$2) $+ ). Nutrauktas ID ( $+ $2 $+ ) balsavimas.
    } 
    else { msg $chan Blogas ID }
  }
  else msg $nick Tau nesuteikta privilegija naudoti sia komanda!
}

on *:text:.pabaigti *:#w*: {
  if (@ $+ $nick $+ @ isin %allow.users) {
    if ($2 isnum 200-500) && ($2 isin %pids) && ($3 isnum 0-2) {
      var %tmp.num 1
      var %tmp.rez
      var %tmp.nick
      var %tmp.txt
      write -c 5pt.txt
      write -c 4pt.txt
      write -c 3pt.txt
      write -c 1pt.txt
      while (%tmp.num <= $lines(rez.ini)) {
        %tmp.txt = $read(rez.ini,%tmp.num)
        if ($left(%tmp.txt,1) == [) {
          %tmp.nick = $mid(%tmp.txt,2,$calc($len(%tmp.txt)-2))
        }
        if ($left(%tmp.txt,4) == $2 $+ $chr(61)) {
          %tmp.txt = $remove(%tmp.txt,$2 $+ $chr(61))
          if ($gettok(%tmp.txt,1,32) == $3) {
            if ($3 == 0) { write 5pt.txt %tmp.nick }
            else {
              %tmp.rez = $abs($calc($gettok(%tmp.txt,2,32)-$4))
              if (%tmp.rez == 0) { write 4pt.txt %tmp.nick }
              elseif (%tmp.rez <= 3) { write 3pt.txt %tmp.nick }
              else { write 1pt.txt %tmp.nick }
            }
          }
        }
        inc %tmp.num
      }
      var %koms $readini(ids.ini,teams,$2)
      msg $chan Rungtynes, $gettok(%koms,1,58) $3 $gettok(%koms,2,58) pasibaige! Ieskoma laimetoju...
      if ($3 == 0) { laim.5pt $chan }
      else { laim.4pt $chan }
      %pids = $remove(%pids,$2)
    }
    else { msg $chan Blogas ID }
  }
  else msg $nick Tau nesuteikta privilegija naudoti sia komanda!
}

on *:text:.reg *:#w*: {
  if (@ $+ $nick $+ @ isin %allow.users) {
    if ($2 isnum 200-500) && (!$readini(ids.ini,teams,$2)) {
      writeini ids.ini teams $2 $3
      %ids = %ids $2
      msg $chan Uzregistruotos naujos rungtynes ( $+ $3 $+ ). Nuo siol galima balsuoti uz ID ( $+ $2 $+ ).
    }
    else { msg $chan Blogas ID }
  }
  else msg $nick Tau nesuteikta privilegija naudoti sia komanda!
}

alias laim.5pt {
  var %tmp 1
  var %nick
  var %texts 1
  var %txt1
  while (%tmp <= $lines(5pt.txt)) {
    %nick = $read(5pt.txt,%tmp)
    writeini rez.ini %nick points $calc(5+$readini(rez.ini,%nick,points))
    if ($len(%txt [ $+ [ %texts ] ]) <= 400) { %txt [ $+ [ %texts ] ] = %txt [ $+ [ %texts ] ]  %nick }
    else { inc %texts | var %txt [ $+ [ %texts ] ] | %txt [ $+ [ %texts ] ] = %txt [ $+ [ %texts ]  }
    inc %tmp
  }
  msg $1 Penkiu tasku laimetojai:
  %tmp = 1
  while (%tmp <= %texts) {
    .timer 1 %tmp msg $1 $iif(%txt [ $+ [ %tmp ] ],%txt [ $+ [ %tmp ] ],Nera!)
    inc %tmp
  }
}

alias laim.4pt {
  var %tmp 1
  var %nick
  var %texts 1
  var %txt1
  while (%tmp <= $lines(4pt.txt)) {
    %nick = $read(4pt.txt,%tmp)
    writeini rez.ini %nick points $calc(4+$readini(rez.ini,%nick,points))
    if ($len(%txt [ $+ [ %texts ] ]) <= 400) { %txt [ $+ [ %texts ] ] = %txt [ $+ [ %texts ] ]  %nick }
    else { inc %texts | var %txt [ $+ [ %texts ] ] | %txt [ $+ [ %texts ] ] = %txt [ $+ [ %texts ]  }
    inc %tmp
  }
  msg $1 Keturiu tasku laimetojai:
  %tmp = 1
  while (%tmp <= %texts) {
    .timer 1 %tmp msg $1 $iif(%txt [ $+ [ %tmp ] ],%txt [ $+ [ %tmp ] ],Nera!)
    inc %tmp
  }
  .timer 1 $calc(%texts + 1) laim.3pt $1
}

alias laim.3pt {
  var %tmp 1
  var %nick
  var %texts 1
  var %txt1
  while (%tmp <= $lines(3pt.txt)) {
    %nick = $read(3pt.txt,%tmp)
    writeini rez.ini %nick points $calc(3+$readini(rez.ini,%nick,points))
    if ($len(%txt [ $+ [ %texts ] ]) <= 400) { %txt [ $+ [ %texts ] ] = %txt [ $+ [ %texts ] ]  %nick }
    else { inc %texts | var %txt [ $+ [ %texts ] ] | %txt [ $+ [ %texts ] ] = %txt [ $+ [ %texts ]  }
    inc %tmp
  }
  msg $1 Triju tasku laimetojai:
  %tmp = 1
  while (%tmp <= %texts) {
    .timer 1 %tmp msg $1 $iif(%txt [ $+ [ %tmp ] ],%txt [ $+ [ %tmp ] ],Nera!)
    inc %tmp
  }
  .timer 1 $calc(%texts + 1) laim.1pt $1
}

alias laim.1pt {
  var %tmp 1
  var %nick
  var %texts 1
  var %txt1
  while (%tmp <= $lines(1pt.txt)) {
    %nick = $read(1pt.txt,%tmp)
    writeini rez.ini %nick points $calc(1+$readini(rez.ini,%nick,points))
    if ($len(%txt [ $+ [ %texts ] ]) <= 400) { %txt [ $+ [ %texts ] ] = %txt [ $+ [ %texts ] ]  %nick }
    else { inc %texts | var %txt [ $+ [ %texts ] ] | %txt [ $+ [ %texts ] ] = %nick }
    inc %tmp
  }
  msg $1 Vieno tasko laimetojai:
  %tmp = 1
  while (%tmp <= %texts) {
    .timer 1 %tmp msg $1 $iif(%txt [ $+ [ %tmp ] ],%txt [ $+ [ %tmp ] ],Nera!)
    inc %tmp
  }
}