User Control Panel
Advertisements

HELP US, HELP YOU!

Admin only Command...?

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl
View unanswered posts
Author Message
Cheatsfp
Member
Member


Joined: 30 Dec 2003
Posts: 109

Reputation: 30.8Reputation: 30.8Reputation: 30.8

PostPosted: Thu Jan 01, 2004 7:08 pm    Post subject: Reply with quote

Hi,

It seems that I am having trouble with something. With my Block & Unblock command, I only want the admin (me) to be able to use this, and no one else.

Would anyone care to share how to do this?

Thank you! Smile
Back to top
Tony_shu
God Like
God Like


Joined: 12 Nov 2003
Posts: 624

Reputation: 42.9Reputation: 42.9Reputation: 42.9Reputation: 42.9

PostPosted: Thu Jan 01, 2004 7:33 pm    Post subject: Reply with quote

Just place this in the block/unblock subs (underneath the part of the code that retrieves the victim .... ie my $victim = shift; ....)

Code:
#Asks if this is an admin-only command? (1 for yes, 0 for no).<br />my $adminonly = 1;<br /><br />#Retrieves the admin's screenname.<br />open (FILE, "admin.txt");<br />my @admin = <FILE>;<br />close(FILE);<br />chomp @admin;<br /><br />my $is_admin = 0;<br /><br />foreach my $admin (@admin) {<br />           if ($victim eq $admin) {<br />            $is_admin = 1;<br />            break;<br />           }<br />}


And after this, do the following:
Code:
if ($is_admin == 1) {<br />          #################################<br />          Place what you want the bot to do<br />          #################################<br />}


So the file should looke somethign like this...
Code:
sub block {<br /><br />           my ($victim,$msg) = (shift,shift);<br /><br />           #Asks if this is an admin-only command? (1 for yes, 0 for no).<br />           my $adminonly = 1;<br /><br />           #Retrieves the admin's screenname.<br />           open (FILE, "admin.txt");<br />           my @admin = <FILE>;<br />           close(FILE);<br />           chomp @admin;<br /><br />           my $is_admin = 0;<br /><br />           foreach my $admin (@admin) {<br />                      if ($victim eq $admin) {<br />                       $is_admin = 1;<br />                       break;<br />                      }<br />           }<br /><br />           if ($is_admin == 0) {<br />          #################################<br />          Place what you want the bot to do<br />          #################################<br />           }<br /><br />           return $reply;<br /><br />}<br />1;


And in the same folder/directory you have the bot.pl file, create a text file called "admin.txt"...and list all your admin's screennames like this:
Quote:
Admin1
Admin2
Admin3

_________________
Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top
Cheatsfp
Member
Member


Joined: 30 Dec 2003
Posts: 109

Reputation: 30.8Reputation: 30.8Reputation: 30.8

PostPosted: Thu Jan 01, 2004 7:50 pm    Post subject: Reply with quote

Okay...

Just to let you know to, I am running WiredBots...

And when I tried it, it did not work, I think I may of did it wrong...

Code:
<br />#################################<br />         Place what you want the bot to do<br />         #################################<br />          }<br /><br />          return $reply;<br /><br />}<br />1;<br />


Okay, I put my block/unblock script code where the #'s are? Or am I suppose to put it where the 'return $reply;' is?

Thanks Smile
Back to top
Tony_shu
God Like
God Like


Joined: 12 Nov 2003
Posts: 624

Reputation: 42.9Reputation: 42.9Reputation: 42.9Reputation: 42.9

PostPosted: Thu Jan 01, 2004 7:56 pm    Post subject: Reply with quote

Where it says "Place what you want the bot to do" ... delete that line and replace it with your code
_________________
Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top
Cheatsfp
Member
Member


Joined: 30 Dec 2003
Posts: 109

Reputation: 30.8Reputation: 30.8Reputation: 30.8

PostPosted: Thu Jan 01, 2004 8:04 pm    Post subject: Reply with quote

It worked. Thank you very much!

Smile
Back to top
Tony_shu
God Like
God Like


Joined: 12 Nov 2003
Posts: 624

Reputation: 42.9Reputation: 42.9Reputation: 42.9Reputation: 42.9

PostPosted: Thu Jan 01, 2004 8:07 pm    Post subject: Reply with quote

You're welcome Very Happy
_________________
Anthony Arslan
@-Squared Enterprises
MacroHard Corporation
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Perl All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group