# getops.irc by phos # and i still aint finished # greets go to those that have emailed me # thanks for your support # # released on 7/13/05 # MY PEOPLE; alyssa kulj rza sgamer and my dog butane # danfare@jircii.info for feedback # http://deep.jircii.info/ for more of my scripts # # DO YOU SCRIPT? upload your scripts on my website! alias getophelp { echo("/getophelp: /getop [get ops] /sptog [show pass toggle] /addbot /rembot /listbot"); } call("/getophelp"); sub rdbotlst { $path = getScriptResource("getops.irc", "bots.lst"); $botinfo = openf($path); @botinfo = readAll($botinfo); $r0 = "0"; $r-1 = "$1 - 1"; $realn = $1; #= iff($1 eq "0", $r0, $r-1); @specbotinfo = split("", @botinfo[$realn]); ($botnick, $bothost, $botpass) = @specbotinfo; return; } alias getop { $path = getScriptResource("getops.irc", "bots.lst"); $botlist = openf($path); @blist = readAll($botlist); if (!-istrue @blist[0]) { echo("/getop: there aren't any bots in your bot list"); return; } $bsize = size(@blist); echo("/getop: trying $bsize bot(s)."); for ($x = 0; $x < size(@blist); $x++) { rdbotlst($x); if (getAddress($botnick) eq "$bothost") { sendRaw("PRIVMSG $botnick :op $botpass"); } } } sub displayPass { $len = int(strlen($1)); $percent = $len * 0.80; $star = '*' x $percent; $r = left($1,$percent); $r = replace($1, $r, $star); return $r; } alias sptog { if ($1 eq 'on') { setProperty(sptog, "on"); $sptog = getProperty(sptog); echo("/sptog: showing password: $sptog"); return; } if ($1 eq 'off') { setProperty(sptog, "off"); $sptog = getProperty(sptog); echo("/sptog: showing password: $sptog"); return; } else { echo("/sptog: /sptog on|off :: currently: $sptog"); return; } } alias addbot { $addr = getAddress($1); if (!-istrue $addr) { echo("/addbot: unknown host, retry."); sendRaw("who $1"); return; } if (!-istrue $2) { echo("/addbot: /addbot \bBOTNAME PASSWORD\b"); return; } $path = getScriptResource("getops.irc", "bots.lst"); $x = ">> $+ $path"; $botlist = openf($x); println($botlist, "$1 $+  $+ $addr $+  $+ $2"); $pass = displayPass($2); echo("/addbot: adding bot: $1 addr: $addr pass: $pass"); closef($botlist); return; } alias listbot { $path = getScriptResource("getops.irc", "bots.lst"); $botlist = openf($path); @blist = readAll($botlist); for ($x = 0; $x < size(@blist); $x++) { rdbotlst($x); $rx = $x + 1; $sptog = getProperty(sptog); $dpass = displayPass($botpass); $pass = iff($sptog eq "on", $botpass, $dpass); echo("# $+ $[3]rx botnick: $botnick addr: $bothost pass: $pass"); } closef($botlist); } alias rembot { $path = getScriptResource("getops.irc", "bots.lst"); if (!-isFile $path) { echo("/rembot: there is no bot.lst in your script directory ref: /addbot"); return; } $botlist = openf($path); @blist = readAll($botlist); if (!-istrue @blist[0]) { echo("/rembot: there are no bots in your bots list. ref: /addbot"); return; } closef($botlist); $lmo = strlen($1) - 1; $num = right($1, $lmo); if ((charAt($1, 0) !eq '#') || (!-isnumber $num)) { echo("/rembot: /rembot \b#NUM\b"); return; } else { $realn = $num - 1; #get number one less cause arrays start at 0 rdbotlst($realn); if ($realn >= size(@blist)) { echo("/rembot: sorry, that is an unknown bot. ref: /listbot"); return; } removeAt(@blist, $realn); echo("/rembot: removing bot from bot list: $botnick $+ ! $+ $bothost"); $botlist = openf("> $+ $path"); if (!-istrue @blist[0]) { echo("/rembot: there are no bots in your bot list, skipping re-write"); return; } for ($x = 0; $x < size(@blist); $x++) { println($botlist, @blist[$x]); } closef($botlist); } }