|
DuXxXieJ
|
DuXxXieJ
|
ON *:TEXT:*:?:{
if $1- == !login %admincode1 || $nick == %admin1 {
msg $nick .: Admin nickname: %admin1 . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: %admincode1 :.
.halt
}
Else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
.halt
}
}
It works, but when you're saying something else it does the same too :|
(15:48) <Duck_Power> !logn
(15:48) <CDuck> .: Admin nickname: Duck_Power . :.
(15:48) <CDuck> .: Log in status: Logged in. :.
(15:48) <CDuck> .: Log in code: vlinder1 :.
(15:50) <Duck_Power> !login vlinder1
(15:50) <CDuck> .: Admin nickname: Duck_Power . :.
(15:50) <CDuck> .: Log in status: Logged in. :.
(15:50) <CDuck> .: Log in code: vlinder1 :.
(15:50) <Duck_Power> aa
(15:50) <CDuck> .: Admin nickname: Duck_Power . :.
(15:50) <CDuck> .: Log in status: Logged in. :.
(15:50) <CDuck> .: Log in code: vlinder1 :.
;x
|
|
|
|
Joined: Jan 2007
Posts: 259
Fjord artisan
|
Fjord artisan
Joined: Jan 2007
Posts: 259 |
You're using OR instead of AND (|| instead of &&), thats whats causing your problem. Also, I would suggest doing this instead:
on *:text:*:?: {
if ($1 == !login) {
if (($2- == %admincode1) && ($nick == %admin1)) {
msg $nick .: Admin nickname: %admin1 . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: %admincode1 :.
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
Never use halt, unless you need to stop any more events of the same type from processing.
Last edited by Kardafol; 31/03/07 03:20 PM.
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
on *:text:*:?: {
if ($1- == !add-admin) {
if (($nick == %superowner)) {
set %Admin2 $2-
set %admincode2 Adminneke
msg $nick .: New admin added :.
msg $nick .: Admin is named " $+ %admin2 $+ " :.
msg $nick .: Ww %admin2 == %admincode2 :.
}
Else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
But why isn't that setting the admin? I think something is wrong with the
|
|
|
|
Joined: Jan 2007
Posts: 1,155
Hoopy frood
|
Hoopy frood
Joined: Jan 2007
Posts: 1,155 |
if ($1- == !add-admin) { if (($nick == %superowner)) {
Try:
if ($1 == !add-admin) { if ($nick == %superowner) {
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
on *:text:*:?: {
if ($1 == !login) {
if (($2- == %admincode1) && ($nick == %admin1)) {
msg $nick .: Admin nickname: %admin1 . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: %admincode1 :.
}
Else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
if ($1 == !login) {
if (($2- == %admincode2) && ($nick == %admin2)) {
msg $nick .: Admin nickname: %admin2 . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: %admincode2 :.
}
Else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
This is the last code i had... Coz nothing is working? It does double:
(22:06) <Duck_Power> !login vlinder1
(22:06) <CDuck> .: Admin nickname: Duck_Power . :.
(22:06) <CDuck> .: Log in status: Logged in. :.
(22:06) <CDuck> .: Log in code: vlinder1 :.
(22:06) <CDuck> .: Your nickname: Duck_Power. :.
(22:06) <CDuck> .: You're a admin?: No :.
(22:06) <CDuck> .: You're not permitted to use this command :.

|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Both your if statements get processed, and thats why you get the double result. Instead use: on *:text:*:?: {
if ($1 == !login) {
if (($2- == %admincode1) && ($nick == %admin1)) {
msg $nick .: Admin nickname: %admin1 . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: %admincode1 :.
}
elseif (($2- == %admincode2) && ($nick == %admin2)) {
msg $nick .: Admin nickname: %admin2 . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: %admincode2 :.
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
But how do you use a if variabel?
If %Admin2 == Off
xD
;x
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Just like you show it... though you are checking if it's "Off" there, but in the script, that's being checked with $nick... something seems strange there.
Btw, *use* parentheses. It makes things easier to read.
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
Because like erm...
You only can log in if you are NOT logged in. Like a variabel:
%admin1status OFF %admin1status ON
And you only can log out if you ARE logged in.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
Okay, we're going to improve things a bit... Set your variables like this: %admin admin1 admin2 admin3 %admincode admincode1¤admincode2¤admincode3 %adminstatus adminstatus1 adminstatus2 adminstatus3
on *:text:*:?: {
if ($1 == !login) {
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
if ($gettok(%admincode,%nick,164) == $2-) {
if ($gettok(%adminstatus,%nick,32) == Off) {
msg $nick .: Admin nickname: $nick . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: $gettok(%admincode,%nick,164) :.
set %adminstatus $puttok(%adminstatus,On,%nick,32)
}
else {
msg $nick .: Already logged in :.
}
}
else {
msg $nick .: Invalid login :.
}
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
This will allow you to not duplicate everything for every nick you want to allow to use the command. Note that you'll need to change any parts of the script that change the passwords, add/remove nicks, and change the status to Off when logging out. To do that, use the $puttok method above, or ask for help if you need it.
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
%admin admin1 admin2 admin3 %admincode admincode1¤admincode2¤admincode3 %adminstatus adminstatus1 adminstatus2 adminstatus3
%admin Duck_Power Troy Foxman %admincode vlinder1 Adminneke Ryan I dont get the "%adminstatus adminstatus1 adminstatus2 adminstatus3" Like: %adminstatus Off on nothere ???
|
|
|
|
Joined: Apr 2006
Posts: 464
Fjord artisan
|
Fjord artisan
Joined: Apr 2006
Posts: 464 |
Erm no, it would be: %adminstatus Off Off Off
Then, admin2 logs in, it will change in: %adminstatus Off On Off
Then, admin3 logs in: %adminstatus Off On On
Then, admin2 logs out: %adminstatus Off Off On
Etc. Start with: %adminstatus Off Off Off
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
(13:32) <Duck_Power> !login vlinder1 (13:32) <CDuck> .: Invalid login :. (13:32) <Duck_Power> >;o (13:32) <Duck_Power> !login Adminneke (13:32) <CDuck> .: Invalid login :. (13:32) <Duck_Power> !login test (13:32) <CDuck> .: Invalid login :. And my variabels are: %admin Duck_Power Troy Lal %admincode vlinder1 Adminneke test %adminstatus Off Off Off And I use the last script that was sended...
on *:text:*:?: {
if ($1 == !login) {
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
if ($gettok(%admincode,%nick,164) == $2-) {
if ($gettok(%adminstatus,%nick,32) == Off) {
msg $nick .: Admin nickname: $nick . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: $gettok(%admincode,%nick,164) :.
set %adminstatus $puttok(%adminstatus,On,%nick,32)
}
else {
msg $nick .: Already logged in :.
}
}
else {
msg $nick .: Invalid login :.
}
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
Last edited by DuXxXieJ; 01/04/07 11:35 AM.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
You didn't look closely at the %admincode variable. Don't use spaces. Use the character I gave you.
Note that the way I have it allows a code to be multiple words. I did that because you used $2- to check the password (meaning there could be multiple words). If you only want it to use a single word as a password, let me know and I'll change it to only allow a single word as a password and then you can use spaces in the variable.
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
(16:42) <Duck_Power> !login vlinder1 (16:42) <CDuck> .: Admin nickname: Duck_Power . :. (16:42) <CDuck> .: Log in status: Logged in. :. (16:42) <CDuck> .: Log in code: vlinder1 :. (16:42) <Duck_Power> !login vlinder1 (16:42) <CDuck> .: Already logged in :. That's cool. But how can I change:
on *:text:*:?: {
if ($1 == !login) {
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
if ($gettok(%admincode,%nick,164) == $2-) {
if ($gettok(%adminstatus,%nick,32) == Off) {
msg $nick .: Admin nickname: $nick . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: $gettok(%admincode,%nick,164) :.
set %adminstatus $puttok(%adminstatus,On,%nick,32)
}
else {
msg $nick .: Already logged in :.
}
}
else {
msg $nick .: Invalid login :.
}
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
to logout? I gotted a Add-Admin too. Before I got your login.
on *:text:*:?: {
if ($1 == !add-admin) {
if ($nick == %superowner) {
set %Admin2 $2
set %admincode2 $3
msg $nick .: New admin added :.
msg $nick .: Admin is named " $+ %admin2 $+ " :.
msg $nick .: Ww %admin2 == %admincode2 :.
}
Else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
But I can't find the code, to add A name at the %Admin Duck_Power Troy Lal And the same with the %admincode and %adminstatus
Last edited by DuXxXieJ; 01/04/07 02:47 PM.
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
on *:text:*:?: {
if ($1 == !login) {
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
if ($gettok(%admincode,%nick,164) == $2-) {
if ($gettok(%adminstatus,%nick,32) == Off) {
msg $nick .: Admin nickname: $nick . :.
msg $nick .: Log in status: Logged in. :.
msg $nick .: Log in code: $gettok(%admincode,%nick,164) :.
set %adminstatus $puttok(%adminstatus,On,%nick,32)
}
else {
msg $nick .: Already logged in :.
}
}
else {
msg $nick .: Invalid login :.
}
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
elseif ($1 == !logout) {
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
if ($gettok(%admincode,%nick,164) == $2-) {
if ($gettok(%adminstatus,%nick,32) == On) {
msg $nick .: Admin nickname: $nick . :.
msg $nick .: Log in status: Logged out. :.
msg $nick .: Log out code: $gettok(%admincode,%nick,164) :.
set %adminstatus $puttok(%adminstatus,Off,%nick,32)
}
else {
msg $nick .: Already logged out :.
}
}
else {
msg $nick .: Invalid logout :.
}
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
elseif ($1 == !add-admin) {
if ($nick == %superowner) {
if (!$3) { msg $nick Invalid format: !add-admin nick passcode | return }
var %nick = $findtok(%admin,$nick,32)
if (%nick) {
msg $nick .: $2 already added :.
msg $nick .: $2's password is $gettok(%admincode,%nick,164) :.
return
}
else {
set %admin $addtok(%admin,$2,32)
set %admincode $addtok(%admincode,$3-,164)
set %adminstatus $addtok(%adminstatus,Off,32)
msg $nick .: New admin added :.
msg $nick .: Admin is named " $+ $2 $+ " :.
msg $nick .: Ww $2 == $3- :.
}
}
else {
msg $nick .: Your nickname: $nick $+ . :.
msg $nick .: You're a admin?: No :.
msg $nick .: You're not permitted to use this command :.
}
}
}
Notice the changes made from one code to the next. That should help you to understand the commands used. If you have questions, let me know. Note: Logout requires the use of the password, the same as logging in does. EDIT: Added !add-admin code.
Last edited by Riamus2; 01/04/07 03:32 PM.
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
And that one from Add-Admin??
|
|
|
|
Joined: Oct 2004
Posts: 8,061
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,061 |
|
|
|
|
DuXxXieJ
|
DuXxXieJ
|
Eh, I've tested it. But I said it needs to add a name at the %admin Duck_Power Troy Lal
%admin Duck_Power Troy Lal %admincode vlinder1¤Adminneke¤test %adminstatus On Off Off %Admin2 Foxman %admincode2 Test
That's what I got now >_>
Last edited by DuXxXieJ; 01/04/07 03:36 PM.
|
|
|
|
|