|
| Author |
Message |
Cheatsfp Member

Joined: 30 Dec 2003 Posts: 109
   
|
Posted: Thu Jan 01, 2004 7:08 pm Post subject: |
|
|
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!  |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Thu Jan 01, 2004 7:33 pm Post subject: |
|
|
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

Joined: 30 Dec 2003 Posts: 109
   
|
Posted: Thu Jan 01, 2004 7:50 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Thu Jan 01, 2004 7:56 pm Post subject: |
|
|
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

Joined: 30 Dec 2003 Posts: 109
   
|
Posted: Thu Jan 01, 2004 8:04 pm Post subject: |
|
|
It worked. Thank you very much!
 |
|
| Back to top |
|
 |
Tony_shu God Like

Joined: 12 Nov 2003 Posts: 624
    
|
Posted: Thu Jan 01, 2004 8:07 pm Post subject: |
|
|
You're welcome  _________________ Anthony Arslan
@-Squared Enterprises
MacroHard Corporation |
|
| Back to top |
|
 |
|