mIRC Home    About    Download    Register    News    Help

Print Thread
#110212 05/02/05 12:54 PM
Joined: Sep 2004
Posts: 17
_
Pikka bird
OP Offline
Pikka bird
_
Joined: Sep 2004
Posts: 17
Hello!

Whenever I add an account it dissapears after I have disconnected/restart the mirc bot. I typed in the login command: */ctcp mybot login password*
(I did have an account on my bot) but the script is replaying that the system doesnt contain any user with that name.
* Patrik No such account
Weird, could anyone please help me with this error?

I still got two more questions left,

Whenever I join the specific channel I want the loginsystem to run automatically (when I connect the bot and join the specific channel I need to type /loginconf in order to make it work and my question is: Is it possible to make it so it automatically starts after I have joined the
channel?

I also want the script to auto-op the users that login to the system..i.e typed in the right password and gets access granted to the channel..
(it would be a good idea if you try the script yourself, if you dont know what I mean)

Code:
alias loginconf { 
  if ($nick != $me) { 
  } 
  if ( $hget(Accts,Exists) != true ) { 
    hmake Accts 
    hadd Accts Exists true 
    echo $colour(info) -a * Login System has been successfully set up. 
    halt 
  } 
  if ( !$2 ) { 
    echo $coour(info) -a * SYNTAX: /loginconf <add|del|view> [account] [password] 
    halt 
  } 
  if ( $1 == view ) || ( $1 == info ) || ( $1 == pass ) { 
    if ( !$hget(Accts,$2) ) { 
      echo $colour(info) -a * $2 No such account 
      halt 
    } 
    echo $colour(info) -a * $2 $+ 's password is $hget(Accts,$2) 
  } 
  if ( $1 == add ) { 
    if ( !$3 ) { 
      echo $colour(info) -a * SYNTAX: /loginconf <add|del|view> [account] [password] 
      halt 
    } 
    hadd Accts $2 $3 
    echo $colour(info) -a * Added $2 to account list, password $3 
  } 
  elseif ( $1 == del ) || ( $1 == rem ) { 
    if ( !$hget(Accts,$2) ) { 
      echo $colour(info) -a * $2 no such account 
      halt 
    } 
    hdel Accts $2 
    echo $colour(info) -a * Removed $2 from account list 
  } 
} 
ctcp *:LOGIN: { 
  if ( $hget(Accts,Exists) != true ) { 
    msg $nick Login System has not yet been set up. 
    halt 
  } 
  if ( !$hget(Accts,$nick) ) { 
    msg $nick You do not have an account! only staff members on #SSL-Support will gain access to this channel. 
    halt 
  } 
  if ( !$2 ) { 
    msg $nick Syntax: LOGIN <password> 
    halt 
  } 
  if ( $2 != $hget(Accts,$nick) ) { 
    msg $nick Access denided, you typed in wrong password. 
    halt 
  } 
  if ( $nick !ison #SSL-Helpers ) { 
    msg $nick You must be on $v2 to log in! 
    halt 
  } 
  msg $nick Access granted, welcome to the SSL's supports staff channel. 
  timerkb. $+ $nick off 
} 
on *:JOIN:#SSL-Helpers: { 
  msg $nick $+ , You have 40 seconds to log in before being kickbanned. Just a reminder, use SYNTAX: /ctcp P login *YourPassWordHere* 
  timerkb. $+ $nick 1 40 ban -ku300 $chan $nick Access denied, either you typed in wrong password, your not recognized or you dont have an account. For your information: I only recognize the certain nick that is in my database, if you changed your nick and after that tryed to login then that's why you got banned. If you got banned for using an unrecognized nick please type Syntax: /cs unban #SSL-Support or if you typed in wrong password. 
} 
on *:START: { 
  hload Accts Accts.dat 
} 
on *:EXIT: { 
  hsave Accts Accts.dat 
} 


*!*@help.me.if.you.can
Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Without going through it all...
Code:
on *:START: { 
  hload Accts Accts.dat 
} 

You must hmake the table before you can load data into it...
Code:
on *:START: { 
  hmake Accts
  hload Accts Accts.dat 
}

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Heres some things i saw also, but i think Iori right u wont load the table because there is no /hmake

In the alias loginconf {

if ($nick != $me) { }
Inside the alias that doesnt do anything , $nick is likely to not be $me unless you triggered this script on a remote event, and then you dont do anything anyway!??!?!

if ( $hget(Accts,Exists) != true ) {
you can use
if (!$hget(Accts)) {
to test if the hashtable does not exist
If u leave it as it is, someone can join the channel using the nick "Exists" and use the password "true"

echo $coour(info) -a * SYNTAX: /loginconf <add|del|view> [account] [password]
Typeo $colour


In the ctcp *:LOGIN: {
if (!$hget(Accts)) {
well detect the hashtable not loaded

in the ON *:JOIN:#SSL-Helpers: {
msg $nick $+ , You have 40 seconds to log in before being kickbanned. Just a reminder, use SYNTAX: /ctcp P login *YourPassWordHere*
replace /ctcp P with /ctcp $me, even if your nick is P


lastly...

on *:START: {
hfree -w accts
hmake accts
hload Accts Accts.dat
}
on *:EXIT: {
hsave -o Accts Accts.dat
}


I would consider adding a hsave -o Accts Accts.dat after each alteration of the database inside the alias loginconf, since why wait for a shutdown before saving the database, u might get a system crash and not have the database updated.

In answer two question 2, i think it well work when u joiin the channel, before it didnt work becuase the hastable didnt exist.
q3 : put the opping command in after the timerkb. $+ $nick off

Joined: Aug 2003
Posts: 1,831
I
Hoopy frood
Offline
Hoopy frood
I
Joined: Aug 2003
Posts: 1,831
Just a silly Q
on *:START: {
hfree -w accts
^^ Where would the table to be freed come from if mirc is just started? grin

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Its just a habit i have picked up, I always hfree before doing a hmake, i didnt really even think about it being in a START event.
And it cant hurt, and since a /hmake on a existing table well halt the script and stop the /hload, its not like it well be run 100,000 times smile


Link Copied to Clipboard