There is no need to see if there is another download because the map files take about 2 seconds to download.

Now I've edited it abit, and it deosn't seem to work...
Can someone help me out? I dont see whats wrong with it...

Code:
;;Fetch Maps

on *:text:*fetch*:*:{
  if ($1 == $me) {
    set %map.address $3
    set %map.name $4-
    set %.map $right( %map.name , 4)
    if (%.map !== .map) { set %map.name %map.name $+ .map }
    if ($exists(c:/winbolo/maps/ $+ %map.name ) == $true ) { msg $chan I already have that map. | goto havemap }
    sockopen fetch %map.address 80
    :havemap
  }
}

on *:sockopen:fetch:{
  if ($sockerr) return
  sockwrite -n $sockname GET / HTTP/1.1
  sockwrite -n $sockname Host: %map.address
  sockwrite -n $sockname Accept: */*
  sockwrite -n $sockname Connection: Close
  sockwrite -n $sockname
  msg $chan Downloading %map.name ....
}

on *:sockread:fetch:{
  ; check if the header has been recieved
  ; if so read the data to a binvar and bwrite it
  if $sock( $sockname ).mark {
    sockread -f &a
    bwrite c:/winbolo/maps/ $+ %map.name -1 -1 &a
    msg $chan Download Complete!
  }
  ; Otherwise, read the header data and do nothing with it
  else {
    var %a | sockread %a
    ; The header will be followed by a blank line
    ; If the var is empty the header has been recieved
    if !%a { sockmark $sockname 1 }
  }
}


P.S. Thanks deegee for your help.

Last edited by harl91; 04/05/07 05:56 PM.