This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Looking for a simple "on command - msg to chan" sc

Old posts that have not been replied to for several years.
Locked
9
911

Looking for a simple "on command - msg to chan" sc

Post by 911 »

Hi,

as described in the topic, I need a script whis does the following:


#mainchannel
[time]<nick>!whish 3 mio $
[time]<bot> Nick, your wish has been submitted.
....
....
#masterchannel
<bot> Nicks wish at [time] was: 3 Mio $


maybe not only per !publiccommand but also per /msg.

Anyone knows a script which does this?

tia
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

Code: Select all

bind pub - !which which:pub

set filename which.dat

proc which:pub {nick host hand chan arg} {
  global filename
  if {[ownerison $chan]} {
    foreach user [userlist n] {
      if {[onchan $user $chan]} {
        privmsg "PRIVMSG $nick :New Which\(\002[join [lrange $arg 0 end]]\002\) by \(\002$nick\002\) is been submited on \(\002[clock format [clock seconds] -format \"%A %d %B %Y at %T\"]\002\)
      }
    }
  } else {
    set wfile [open $filename w]
    puts $wfile "n [clock seconds] $nick [join [lrange $arg 0 end]]"
    close $wfile
    putserv "NOTICE $nick :Your Which is been submited."
  }
}

proc ownerison {chan} {
  foreach user [userlist n] {
    if {[onchan $user $chan]} {
      return 1
    }
  }
  return 0
}

bind join - * join:pub

proc join:pub {nick host hand} {
  global filename
  if {[matchattr $nick n] && [file exists $filename]} {
    set rfile [open $filename r]
    set data [read $rfile]
    close $rfile
    foreach line [split $data \n] {
      if {[string -nocase equal n [lindex $line 0]]} {
        privmsg "PRIVMSG $nick :New Which \(\002[join [lrange $line 3 end]]\002\) by \(\002[lindex $line 2]\002\) is been submited on \(\002[clock format [lindex $line 1] -format \"%A %d %B %Y at %T\"]\002\)."
      }
    }
    set wfile [open $filename w]
    foreach line [split $data \n] {
      if {[string match -nocase equal n [lindex $line 0]]} {
        puts $wfile "o [join [lrange $line 1 end]]"
      } else {
      	puts $wfile "$line"
      }
    }
    close $wfile
  }
}
didn't test it but it will notify owner on join if there where no owners present on the channel while the which is submited there this is only public if u want /msg command edit it a bit let me know if it is bugfree sorry got no time and don't feel like testing hehe
XplaiN but think of me as stupid
9
911

Post by 911 »

thx a lot ... with some modifications I finally got what I wanted..

;D
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

np
XplaiN but think of me as stupid
Locked