All pastes #258874 Raw Edit

Mine

public text v1 · immutable
#258874 ·published 2006-11-26 22:11 UTC
rendered paste body
on *:TEXT:?clan*:#:{
  if (!$2) {
    notice $nick *** [ $+ $col1(Clan) $+ $col2(]: You must supply a name)
    halt
  }
  elseif ($2 == zezima || $2 == n0valyfe) {
    notice $nick *** [$+ $col1(Clan) $+ $col2(]: You are not aloud to do that)
  }
  else {
    inc %x 1
    set %clan.name. [ $+ [ %x ] ] $replace($2- ,$chr(32),+)
    set %clan.style. [ $+ [ %x ] ] $iif($left($1,1) == @,msg $chan,.notice $nick)
    sockopen clan. $+ %x runehead.com 80
  }
}
on *:SOCKOPEN:clan.*:{
  sockwrite -n $sockname GET /clans/search.php?search= $+ %clan.name. [ $+ [ %x ] ] $+ &searchtype=exact
  sockwrite -n $sockname Host: $+(www.runehead.com,$crlf,$crlf)   
}
on *:SOCKREAD:clan.*:{
  if ($sockerr) {
    %clan.style. [ $+ [ %x ] ] *** [ $+ $col1(Clan) $+ $col2(]: Error while connecting)
    sockclose $sockname
    halt
  }
  else {
    var %tmp
    sockread %tmp

    if $regex(results,%tmp,/<p>No results were found for the <b>exact</b> search <b>(.*)</b/) {
      %clan.style. [ $+ [ %x ] ] 12 [ $+ $col1(Clan) $+ $col2(]: %clan.name. [ $+ [ %x ] ]) $col1(is not in any clans on) $col2(RuneHead)
      sockclose $sockname
      halt
    }

  }
  if $regex(clan,%tmp,/<td style='width:90px; border-color:#404040;'><a href='(.*)'>(.*)</a></td>/) { 
  %clan.style. [ $+ [ %x ] ] 12 [ $+ $col1(Clan) $+ $col2(]: %clan.name. [ $+ [ %x ] ]) $col1(is in clan:) $col2($regml(clan,2))    }
  if </html> iswm %tmp {
    sockclose $sockname
  }
}
}
on *:SOCKCLOSE:clan.*:{
unset %clan.*
halt
}