Code: Select all
proc war_addmatch {nick uhost handle channel arg} {
  global war_privchan war_counter war_authsys botnick war_playernumber war_trigger
  set channel [string tolower $channel]
  if {$channel==$war_privchan} {
    if {(![matchattr $handle V])&&($war_authsys==1)} {
      putserv "NOTICE $nick :5You are not authed, use /msg $botnick [string trim $war_trigger]admin <password>"
      return 0
    }
    set check [war_charfilter $arg]
    if {$check!=1} {
      putserv "NOTICE $nick :5Invalid character: \"$check\". Please do not use such character in any field."
      return 0
    }
    if {([lsearch $arg "team(*"]==-1)||([lsearch $arg "date(*"]==-1)||([lsearch $arg "map(*"]==-1)} {
      putserv "NOTICE $nick :5Invalid args, you need to enter at least the team(x), date(hh:mm-dd/mm/yy) and map(x) ( + info(x) or number(x) )"
      return 0
    }
    set startindex [lsearch $arg "date(*"]
    set buf [lrange $arg $startindex end]
    set infos [string range $buf 5 [expr [string first ")" $buf]-1]]
    set errormsg [war_checkdate $infos]
    if {$errormsg!=1} {
      putserv "NOTICE $nick :$errormsg"
      return 0
    }
    set infos [clock scan "[string range $infos 12 13][string range $infos 9 10][string range $infos 6 7] [string range $infos 0 1][string range $infos 3 4]00"]
    set infos [linsert $infos 0 $war_counter]
    set startindex [lsearch $arg "team(*"]
    set buf [lrange $arg $startindex end]
    set team [string range $buf 5 [expr [string first ")" $buf]-1]]
    set startindex [lsearch $arg "map(*"]
    set buf [lrange $arg $startindex end]
    set map [string range $buf 4 [expr [string first ")" $buf]-1]]
    set info "nothing"
    if {[lsearch $arg "info(*"]>-1} {
      set startindex [lsearch $arg "info(*"]
      set buf [lrange $arg $startindex end]
      set info [string range $buf 5 [expr [string first ")" $buf]-1]]
    }
    set number $war_playernumber
    if {[lsearch $arg "number(*"]>-1} {
      set startindex [lsearch $arg "number(*"]
      set buf [lrange $arg $startindex end]
      set number [string range $buf 7 [expr [string first ")" $buf]-1]]
    }
    set infos [linsert $infos end $team "n/a" "n/a" $map "n/a" $info $number]
    war_insertion $infos
    war_savefiles
    set infos [war_getinfos $war_counter 2]
    incr war_counter
    set id [lindex $infos 0]
    set hour [lindex $infos 1]
    set date [lindex $infos 2]
    set team [lindex $infos 3]
    set maps [lindex $infos 6]
    set info [lindex $infos 8]
    set number [lindex $infos 9]
    if {$number==$war_playernumber} {
      putserv "PRIVMSG $channel : 5New war on $date at $hour against $team . Maps: $maps . Infos: $info ( ID $id )"
    } else {
      putserv "PRIVMSG $channel : 5New war on $date at $hour against $team . Maps: $maps . Infos: $info . Player number: $number . ( ID $id )"
    }
    war_automanagement
  }
}
Code: Select all
proc war_addmatch {nick uhost handle channel arg} {
  global war_privchan war_counter war_authsys botnick war_playernumber war_trigger
  set channel [string tolower $channel]
  if {$channel==$war_privchan} {
    if {(![matchattr $handle V])&&($war_authsys==1)} {
      putserv "NOTICE $nick :5You are not authed, use /msg $botnick [string trim $war_trigger]admin <password>"
      return 0
    }
    set check [war_charfilter $arg]
    if {$check!=1} {
      putserv "NOTICE $nick :5Invalid character: \"$check\". Please do not use such character in any field."
      return 0
    }
    if {([lsearch $arg "team(*"]==-1)||([lsearch $arg "date(*"]==-1)||([lsearch $arg "map(*"]==-1)} {
      putserv "NOTICE $nick :5Invalid args, you need to enter at least the team(x), date(hh:mm-dd/mm/yy) and map(x) ( + info(x) or number(x) )"
      return 0
    }
    set startindex [lsearch $arg "date(*"]
    set buf [lrange $arg $startindex end]
    set infos [string range $buf 5 [expr [string first ")" $buf]-1]]
    set errormsg [war_checkdate $infos]
    if {$errormsg!=1} {
      putserv "NOTICE $nick :$errormsg"
      return 0
    }
    set infos [clock scan "[string range $infos 12 13][string range $infos 9 10][string range $infos 6 7] [string range $infos 0 1][string range $infos 3 4]00"]
    set infos [linsert $infos 0 $war_counter]
    set startindex [lsearch $arg "team(*"]
    set buf [lrange $arg $startindex end]
    set team [string range $buf 5 [expr [string first ")" $buf]-1]]
    set startindex [lsearch $arg "map(*"]
    set buf [lrange $arg $startindex end]
    set map [string range $buf 4 [expr [string first ")" $buf]-1]]
    set info "nothing"
    if {[lsearch $arg "info(*"]>-1} {
      set startindex [lsearch $arg "info(*"]
      set buf [lrange $arg $startindex end]
      set info [string range $buf 5 [expr [string first ")" $buf]-1]]
    }
    set number $war_playernumber
    if {[lsearch $arg "number(*"]>-1} {
      set startindex [lsearch $arg "number(*"]
      set buf [lrange $arg $startindex end]
      set number [string range $buf 7 [expr [string first ")" $buf]-1]]
    }
    set type "pcw"
    if {[lsearch $arg "type(*"]>-1} {
      set startindex [lsearch $arg "type(*"]
      set buf [lrange $arg $startindex end]
      set type [string range $buf 5 [expr [string first ")" $buf]-1]]
    }
    set infos [linsert $infos end $team "n/a" "n/a" $map "n/a" $info $number $type]
    war_insertion $infos
    war_savefiles
    set infos [war_getinfos $war_counter 2]
    incr war_counter
    set id [lindex $infos 0]
    set hour [lindex $infos 1]
    set date [lindex $infos 2]
    set team [lindex $infos 3]
    set maps [lindex $infos 6]
    set info [lindex $infos 8]
    set number [lindex $infos 9]
    set type [lindex $infos 10]
    if {$number==$war_playernumber} {
      putserv "PRIVMSG $channel : 5New $type on $date at $hour against $team . Maps: $maps . Infos: $info ( ID $id )"
    } else {
      putserv "PRIVMSG $channel : 5New $type on $date at $hour against $team . Maps: $maps . Infos: $info . Player number: $number . ( ID $id )"
    }
    war_automanagement
  }
}

 
   
 