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.

Could it be done better?

Old posts that have not been replied to for several years.
Locked
N
Nexus6
Op
Posts: 114
Joined: Mon Sep 02, 2002 4:41 am
Location: Tuchola, Poland

Could it be done better?

Post by Nexus6 »

#Script is based on Notice Detector, it glines for channel notice made by
#normal user and increases a number in a file. I didn't do proc which #checks if file exists because it exists and no need to check it all the time
#It works for me, i'm just kinda not sure about the part with file. Thanks # any comments
bind NOTC - "*www.*" glinen
bind NOTC - "*http//*" glinen
bind NOTC - "*/server*" glinen
set gtime "5d"

proc glinen {nick uhost handle text dest} {
global botnick gtime
if {![validchan $dest]} { retrun 0 }
if {[matchattr $nick mf|mf $dest] || [isop $nick $dest] || [isvoice $nick $dest] || [matchattr $nick f|f $dest]} {return 0}
if {([isbotnick $nick]) || ([string tolower $nick] == "ChanServ")} {return 0}
set sm "*!*[lindex [split $uhost @] 1]"
putquick "PRIVMSG OperServ :gline $gtime $sm Auto Gline - spamming"
set o_fid [open "spammers.dat" r]
gets $o_fid spammerz
close $o_fid
set o_fid [open "spammers.dat" w]
puts $o_fid "[expr $spammerz + 1]"
close $o_fid
return 1
}

#stats
bind pub m !spammers spammers
proc spammers {nick host hand chan arg} {
global spammerz
set o_fid [open "spammers.dat" r]
gets $o_fid spammerz
close $o_fid
putserv "PRIVMSG $chan :$spammerz have been caught since bla"
}
putlog "Loaded Spam Notice Kill by Neuxs6"
N
Nexus6
Op
Posts: 114
Joined: Mon Sep 02, 2002 4:41 am
Location: Tuchola, Poland

Post by Nexus6 »

I mean this part, it could it be shorter?
set o_fid [open "spammers.dat" r]
gets $o_fid spammerz
close $o_fid
set o_fid [open "spammers.dat" w]
puts $o_fid "[expr $spammerz + 1]"
close $o_fid
# something like

set o_fid [open "spammers.dat" rw]
gets $o_fid spammerz
puts $o_fid "[expr $spammerz + 1]"
close $o_fid
# Thanks in advance for any help
User avatar
stdragon
Owner
Posts: 959
Joined: Sun Sep 23, 2001 8:00 pm
Contact:

Post by stdragon »

What you put is wrong, you have to seek to the beginning before you output. But can I ask, what's the point? heh
Locked