All pastes #735642 Raw Edit

Cup invite Script

public text v1 · immutable
·published 2007-10-13 20:14 UTC
rendered paste body

ON @*:TEXT:!*:#cupinvite: {
  if ($1 == !start)  && ($nick isop $chan) {
    if ( !%cup.start ) {
      if ($2) && ($istok(1on1.2on2.3on3.4on4.5on5,$2,46)) {
        if ($3) && ($3 isnum) && ($istok(8.16.32,$3,46)) {
          set %cup.type $2
          set %cup.teams $3
          set %cup.start yes
          set %cup.players $left($2,1)
          set %cup.team.count 0
          .msg $chan ** [Cup:] %cup.type [Clans:] $($+(0,/,%cup.teams),2) has now Started.
          goto topset
        }
        else .notice $nick ** Insufficient Parameters (Invalid $chr(35) of Teams): !start <CupType> < $+ $chr(35) of Clans (Available: 8,16,32)>
      }
      else .notice $nick ** Insufficient Parameters (Invalid Cup Type): !start <CupType> < $+ $chr(35) of Clans>
    }
    else .notice $nick A Cup has already started. Type !end to end the cup.
  }
  elseif ($1 == !end) && ($nick isop $chan) {
    if (%cup.start) {
      .msg $chan ** [Cup:] %cup.type [Clans:] $($+(%cup.team.count,/,%cup.teams),2) has now Ended.
      topic $chan Welcome to $chan - Cup! [Cup:] No Info [Clans:] No Info
      unset %cup.*
      .remove cup.ini
    }
    else .notice $nick No Cup has started yet.
  }
  elseif ($1 == !add) {
    if ( %cup.start ) {
      if (%cup.team.count < %cup.teams) {
        if ($2) {
          if ( !$readini(cup.ini, %cup.type, $2) ) {
            if ($3) && ($numtok($3-,44) == %cup.players) {
              writeini -n cup.ini %cup.type $2 $3-
              .notice $nick ** Added Clan $2 with Players: $3-
              inc %cup.team.count
              goto topset
            }
            else .notice $nick ** Insufficient Parameters (Incomplete players): !add <ClanName> < $+ %cup.players Player(s) (separated with a comma if more than 1)>
          }
          else .notice $nick Clan $2 has already been added.                   
        }
        else .notice $nick ** Insufficient Parameters (No Clan Name Given): !add <ClanName> < $+ %cup.players Player(s) (separated with a comma if more than 1)>
      }
      else .notice $nick Cup: %cup.type has already reached the max Clan limit.
    }
    else .notice $nick No Cup has started yet.
  }
  elseif ($1 == !del) {
    if (%cup.start) {
      if ($2) {
        if ($ini(cup.ini, %cup.type, $2)) {
          remini cup.ini %cup.type $2
          .notice $nick ** Removed Clan $2 $+ .
          dec %cup.team.count
          goto topset
        }
        else .notice $nick Clan $2 does not exist.
      }
      else .notice $nick ** Insufficient Parameters (No Clan name given): !del <TeamName>
    }
    else .notice $nick No Cup has started yet.
  }
  elseif ($1 == !set) && ($nick isop $chan) {
    if (%cup.start) {
      if ($2 == price) {
        if ($3) {
          set %cup.price $3
          .notice $nick ** Cup %cup.type Price set to $+(',$3,')
        }
        else .notice $nick ** Insufficient Parameters (No Price Set): !set price <Price>
      }
      elseif ($2 == map) {
        if ($3) {
          set %cup.map $3
          .notice $nick ** Cup %cup.type Map set to $+(',$3,')
        }