User Control Panel
Advertisements

HELP US, HELP YOU!

New permissions

 
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help
View unanswered posts
Author Message
Hoyza
Young One
Young One


Joined: 13 Feb 2004
Posts: 91

Reputation: 29Reputation: 29Reputation: 29

PostPosted: Fri Feb 20, 2004 10:33 pm    Post subject: Reply with quote

Can I please have a step by step guide on how to make a new permission for andromeda templated bots. Thanks Very Happy
Back to top
Dazzy
Agent
Agent


Joined: 09 Jan 2004
Posts: 1731

Reputation: 72.3

PostPosted: Fri Feb 20, 2004 10:41 pm    Post subject: Reply with quote

hi....heres my tutorial to add permissions to the andromeda template by eric
hope you dont have any problems

1.you need to edit msn.pm so first open it and find this part:

Code:
sub GetClasses<br />{<br />    my ($bot,$user) = @_;<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["mod","public"] if (exists $bot->{settings}->{mod}->{$user});<br />    return ["public"];<br />}


here is where the classes are stored.

so 1st decide how many you want....im goin to work with a toal of 6 in this order:
owner
admin
supermod
mod
vip
public

next use:
Code:
return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});
and put it in to make up for how many more you need so we get this:

Code:
sub GetClasses<br />{<br />    my ($bot,$user) = @_;<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["mod","public"] if (exists $bot->{settings}->{mod}->{$user});<br />    return ["public"];<br />}


now we need to fill in the positions:
so at the top is the highest position so list our positions like this:
"owner","admin","supermod","mod","vip","public"
then paste this in the top one like so:

Code:
sub GetClasses<br />{<br />    my ($bot,$user) = @_;<br />    return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["mod","public"] if (exists $bot->{settings}->{mod}->{$user});<br />    return ["public"];<br />}
next we do the next one down.....
but we need to take away the highest position on that list......we are aiming to get it down to one.
so:

Code:
sub GetClasses<br />{<br />    my ($bot,$user) = @_;<br />    return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["mod","public"] if (exists $bot->{settings}->{mod}->{$user});<br />    return ["public"];<br />}
one more in case you havnt got the hang of it:


Code:
sub GetClasses<br />{<br />    my ($bot,$user) = @_;<br />    return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","mod","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["mod","public"] if (exists $bot->{settings}->{mod}->{$user});<br />    return ["public"];<br />}
and carry on till you get to the last line:
Code:
return ["public"];
...which you dont need no:
Code:
if (exists $bot->{settings}->{mod}->{$user});

on

so you will now have this:

Code:
sub GetClasses<br />{<br />    my ($bot,$user) = @_;<br />    return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["vip","public"] if (exists $bot->{settings}->{mod}->{$user});<br />    return ["public"];<br />}

right we're goin good
next

we need to alter | this bit on each line
Code:
return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});


so on :
Code:
return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});
owner is the highest power here so we put owner here like so:
Code:
return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{owner}->{$user});

simple.....once more...just in case you havnt picked it up

our line:
Code:
return ["admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});
highest power| admin
so we make sure admin is in
Code:
......{settings}->{admin}->{$user});


now weve done that........we've got:

Code:
sub GetClasses<br />{<br />    my ($bot,$user) = @_;<br />    return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{owner}->{$user});<br />    return ["admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{admin}->{$user});<br />    return ["supermod","mod","vip","public"] if (exists $bot->{settings}->{supermod}->{$user});<br />    return ["mod","vip","public"] if (exists $bot->{settings}->{mod}->{$user});<br />    return ["vip","public"] if (exists $bot->{settings}->{vip}->{$user});<br />    return ["public"];<br />}


rite thats most the work done....

just below all this is :
Code:
sub commands {<br />    my ($bot,$self, $user, $msg) = @_;<br />    $msg ||= "";<br />    my $reply;<br /><br />    if (!keys %{$bot->{commands}})<br />    {<br />        # load the commands if they aren't loaded yet<br />        foreach my $class (reverse ("admin","mod","public")) <br />        {<br />            opendir(DIR, "./commands/$class");<br />            foreach my $file (sort(grep(!/^\./, readdir(DIR)))) {<br />                $file =~ s/\.(.*)$//g;<br />                $bot->{commands}->{$class}->{$file}->{Time} = (stat("./commands/$class/$file.pl"))[9];<br />                $bot->{commands}->{$class}->{$file}->{Info} = do "./commands/$class/$file.pl";<br />            }<br />            closedir(DIR);<br />        }<br />    }

notice half way down we have :
Code:
foreach my $class (reverse ("admin","mod","public"))
we want this to sort ours so we take from this line:
Code:
return ["owner","admin","supermod","mod","vip","public"] if (exists $bot->{settings}->{owner}->{$user});

which is our whole set of permissions
Code:
"owner","admin","supermod","mod","vip","public"

so we end up with replacing:
Code:
foreach my $class (reverse ("admin","mod","public"))
with
Code:
foreach my $class (reverse ("owner","admin","supermod","mod","vip","public"))


that is all with msn.pm
save that

then in c:\andromeda\commands
make sure you have a folder of the exact permissions
so if *lazy* made owner....supermod and vip.....like us....simple make 3 folders and name them "owner" "supermod" "vip




well thats all for now......as your reading this if *lazy* havnt already done so im typing up how to make the command to add,list and remove the permissions
e.g !owner add dazzy2004@hotmail.com


hope you like!
Back to top
Hoyza
Young One
Young One


Joined: 13 Feb 2004
Posts: 91

Reputation: 29Reputation: 29Reputation: 29

PostPosted: Sat Feb 21, 2004 1:43 pm    Post subject: Reply with quote

Brill thanks

I did the !add ... comands myself Wink
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> Code Help 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