rendered paste bodybind pub - !world get:world
bind pub - !pcw get:world
bind msg - !setworld set:world
bind msg - !setpcw set:world
proc get:world {nick uhost hand chan text} {
if {[isvoice $nick $chan] || [isop $nick $chan] || [ishalfop $nick $chan]} {
set hit 0
set fd [open pcw.txt r]
while {![eof $fd]} {
if {[string match -nocase "$chan *" [set world [gets $fd]]]} {
set hit 1
break
}
}
close $fd
if {$hit} {
set world [lindex $world 1]
puthelp "NOTICE $nick :Current PestControl world is\002 $world\002."
return 1
} else {
puthelp "NOTICE $nick :No world currently set."
return 0
}
}
}
proc set:world {nick uhost hand text} {
if {[isop $nick [lindex $text 0]] || [ishalfop $nick [lindex $text 0]]} {
set data $text
set filename pcw.txt
set fileId [open $filename w]
puts $fileId $data
close $fileId
puthelp "NOTICE $nick :PestControl world for\002 [lindex $text 0]\002 set to\002 [lindex $text 1]\002."
}
}