mIRC Home    About    Download    Register    News    Help

Print Thread
Page 1 of 2 1 2
#173872 31/03/07 01:51 PM
D
DuXxXieJ
DuXxXieJ
D
Code:
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 :|

Php Code:

(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

#173875 31/03/07 03:17 PM
Joined: Jan 2007
Posts: 259
K
Fjord artisan
Offline
Fjord artisan
K
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:
Code:
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.
Kardafol #173883 31/03/07 04:18 PM
D
DuXxXieJ
DuXxXieJ
D
Code:
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

Php Code:

if ($1- == !add-admin) {
 

#173892 31/03/07 05:50 PM
Joined: Jan 2007
Posts: 1,155
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,155
if ($1- == !add-admin) {
if (($nick == %superowner)) {



Try:

if ($1 == !add-admin) {
if ($nick == %superowner) {

DJ_Sol #173909 31/03/07 08:08 PM
D
DuXxXieJ
DuXxXieJ
D
Code:
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:

Php Code:

(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 :.
 


confused crazy

#173916 31/03/07 08:54 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
Joined: Apr 2006
Posts: 464
Both your if statements get processed, and thats why you get the double result. Instead use:

Code:
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 :.
    }
  }
}


OrionsBelt #173918 31/03/07 08:56 PM
D
DuXxXieJ
DuXxXieJ
D
But how do you use a if variabel?

If %Admin2 == Off


xD

;x

#173920 31/03/07 08:58 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
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.

#173921 31/03/07 08:59 PM
D
DuXxXieJ
DuXxXieJ
D
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.

Riamus2 #173922 31/03/07 08:59 PM
D
DuXxXieJ
DuXxXieJ
D
I dont get it.

#173926 31/03/07 09:19 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
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

Code:
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.

Riamus2 #173929 31/03/07 09:40 PM
D
DuXxXieJ
DuXxXieJ
D
Quote:

%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

???

#173930 31/03/07 09:55 PM
Joined: Apr 2006
Posts: 464
O
Fjord artisan
Offline
Fjord artisan
O
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

OrionsBelt #173964 01/04/07 11:34 AM
D
DuXxXieJ
DuXxXieJ
D
(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...

Code:
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.
#173977 01/04/07 02:36 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
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.

Riamus2 #173979 01/04/07 02:44 PM
D
DuXxXieJ
DuXxXieJ
D
(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:

Code:
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.


Code:
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.
#173982 01/04/07 02:48 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
Code:
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.
Riamus2 #173987 01/04/07 03:11 PM
D
DuXxXieJ
DuXxXieJ
D
And that one from Add-Admin??

#173991 01/04/07 03:32 PM
Joined: Oct 2004
Posts: 8,061
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Oct 2004
Posts: 8,061
See edited code above.

Riamus2 #173993 01/04/07 03:34 PM
D
DuXxXieJ
DuXxXieJ
D
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.
Page 1 of 2 1 2

Link Copied to Clipboard