mIRC Home    About    Download    Register    News    Help

Page 1 of 2 1 2 >
Topic Options
#173872 - 31/03/07 02:51 PM Login
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
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
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173875 - 31/03/07 04:17 PM Re: Login [Re: DuXxXieJ]
Kardafol Offline
Fjord artisan

Registered: 08/01/07
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.


Edited by Kardafol (31/03/07 04:20 PM)
_________________________
Those who can, cannot. Those who cannot, can.

Top
#173883 - 31/03/07 05:18 PM Re: Login [Re: Kardafol]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
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) {
 
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173892 - 31/03/07 06:50 PM Re: Login [Re: DuXxXieJ]
DJ_Sol Offline
Hoopy frood

Registered: 04/01/07
Posts: 1156
Loc: Seattle
if ($1- == !add-admin) {
if (($nick == %superowner)) {



Try:

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

Top
#173909 - 31/03/07 09:08 PM Re: Login [Re: DJ_Sol]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
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
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173916 - 31/03/07 09:54 PM Re: Login [Re: DuXxXieJ]
OrionsBelt Offline
Fjord artisan

Registered: 25/04/06
Posts: 464
Loc: Amsterdam, NL
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 :.
    }
  }
}


Top
#173918 - 31/03/07 09:56 PM Re: Login [Re: OrionsBelt]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
But how do you use a if variabel?

If %Admin2 == Off


xD

;x
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173920 - 31/03/07 09:58 PM Re: Login [Re: DuXxXieJ]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#173921 - 31/03/07 09:59 PM Re: Login [Re: DuXxXieJ]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
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.
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173922 - 31/03/07 09:59 PM Re: Login [Re: Riamus2]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
I dont get it.
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173926 - 31/03/07 10:19 PM Re: Login [Re: DuXxXieJ]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#173929 - 31/03/07 10:40 PM Re: Login [Re: Riamus2]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
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

???
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173930 - 31/03/07 10:55 PM Re: Login [Re: DuXxXieJ]
OrionsBelt Offline
Fjord artisan

Registered: 25/04/06
Posts: 464
Loc: Amsterdam, NL
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

Top
#173964 - 01/04/07 12:34 PM Re: Login [Re: OrionsBelt]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
(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 :.
    }
  }
}


Edited by DuXxXieJ (01/04/07 12:35 PM)
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173977 - 01/04/07 03:36 PM Re: Login [Re: DuXxXieJ]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#173979 - 01/04/07 03:44 PM Re: Login [Re: Riamus2]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
(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


Edited by DuXxXieJ (01/04/07 03:47 PM)
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173982 - 01/04/07 03:48 PM Re: Login [Re: DuXxXieJ]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
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.


Edited by Riamus2 (01/04/07 04:32 PM)
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#173987 - 01/04/07 04:11 PM Re: Login [Re: Riamus2]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
And that one from Add-Admin??
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
#173991 - 01/04/07 04:32 PM Re: Login [Re: DuXxXieJ]
Riamus2 Offline
Planetary brain

Registered: 13/10/04
Posts: 8327
Loc: MA, USA
See edited code above.
_________________________
Invision Support
#Invision on irc.irchighway.net

Top
#173993 - 01/04/07 04:34 PM Re: Login [Re: Riamus2]
DuXxXieJ Offline
Fjord artisan

Registered: 06/01/07
Posts: 280
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 >_>


Edited by DuXxXieJ (01/04/07 04:36 PM)
_________________________
Squee whenever a squee squee's. Squee whenever a squee does not squee.

Top
Page 1 of 2 1 2 >