CLANBOT w/Loginsys
Posted by nemm91
Thursday, June 10, 2004
Description: this is a clanbot with a login system i dint really get any help with this but i tried and i am still a nub at scripting still but im trying but if you haveing any suggestion or if youd like to help pm meh plz thnx


;aliases
alias -l login_hsh {
  return $scriptdirlogin.hsh
  ;returns <scriptdir>\login.hsh
}

;on text events
on *:text:\login:%channel:{
  ;on text triggers when someone types \login
  if ($hget(users,$nick) == $address($nick,2)) {
    ;check to see if the nicks address matches the address in the hash table
    set %logintime. [ $+ [ $nick ] ] $ctime
    ;set logintime.<nick> $ctime
    notice $nick $nick has Successfully Logged in: address: $address($nick,2)
    ;msg the channel that the user has logged in
    if ($hget(ulogin)) {
      ;check to see if hash table "ulogin" exists
      hadd ulogin $nick $address($nick,2)
      ;add <nick> <address> to hash table: "ulogin"
    }
    else {
      ;if the hash table: "ulogin" doesn't exists
      hmake ulogin 100
      ;make the hash table: "ulogin"
      hadd ulogin $nick $address($nick,2)
      ;add <nick> <address> to hash table: "ulogin"
    }
  }
  else {
    ;if the address wasn't found
    notice $nick $+ , you lack access to use this command
    ;msg the channel that they lack access
  }
}
on *:text:\logout:%channel:{
  ;on text triggers whens someone types @logout
  if ($hget(users,$nick) == $address($nick,2)) {
    ;check to see if the nicks address matches the address in the hash table
    notice $nick you have successfully logged out: address: $address($nick,2)
    ;msg the channel that they have logged out
    notice $nick you've been logged in for $duration($calc($ctime -  [ %logintime. [ $+ [ $nick ] ] ] ))
    ;msg the channel that the nick has been logged in for <duration>
    if ($hget(ulogin)) {
      ;if hash table: "ulogin" exists
      if ($hget(ulogin,$nick)) {
        ;if there is an address for <nick>
        hdel ulogin $nick
        ;delete the <nick> from the table: "ulogin"
      }
    }
  }
}
on *:text:\addlogin*:%channel:{
  ;on text triggers when someone types @addlogin <nick>
  if ($address($nick,2) == *!*@nemisis91.user.gamesurge) && ($nick isop $chan) {
    ;check to see if the <nick> is an op on <chan>
    if ($2) {
      ;if $2 is not $null
      if ($hget(users)) {
        ;check to see if the hash table: "users" exists
        hadd users $2 $address($2,2)
        ;add <nick> <address> to hash table: "users"
        notice $nick added login: $2 - Address: $address($2,2)
        ;msg the channel the added login
      }
      else {
        ;if the hash table: "users" does not exists
        hmake users 100
        ;make the hash table: "users"
        hadd users $2 $address($2,2)
        ;add <nick> <address> to hash table: "users"
        notice $nick added login: $2 - Address: $address($2,2)
        ;msg the channel the added login
      }
    }
    else {
      ;if $2 is null
      notice $nick Please Specify a Nickname, Syntax: @addlogin <nick>
      ;msg the channel the error message
    }
  }
}
on *:text:\help:%channel:{
  ;on text triggers when someone types @help
  if ($hget(ulogin)) {
    ;check to see if hash table: "ulogin" exists
    var %x 1
    ;set a temp var to 1
    var %total $hget(ulogin,0).item
    ;set a var to the total items in hash table: "ulogin"
    if (%total == 0) {
      ;if %total is 0
      notice $nick No Users are logged in
      ;notice <nick> the error message
    }
    else {
      ;if %total is not 0
      notice $nick - $+ %total Users Logged $+ -
      notice $nick Users Logged in:
      ;notice <nick> the messages
      while (%x <= %total) {
        ;while <1> is greater than or equal to the total items in the hash table: "ulogin"
        notice $nick User: $hget(ulogin,%x).item
        ;notice <nick> the users
        inc %x
        ;increment our variable
      }
    }
  }
}
on *:text:\dellogin*:%channel:{
  ;triggers when someone types @dellogin <nick>
  if ($nick isop $chan) {
    ;check to see if <nick> is an op on <chan>
    if ($2) {
      ;if $2 is not $null
      if ($hget(users)) {
        ;check to see if hash table: "users" exists
        if ($hget(users,$2)) {
          ;check to see if <nick> has an address in hash table: "users"
          hdel users $2
          ;delete the <nick> from hash table: "users"
          notice $nick Deleted User: $2 - Address: $address($2,2)
          ;msg the channel the delete message
        }
        else {
          ;if there isn't a address for <nick>
          notice $nick Login Name: $+(",$2,") Does not exist
          ;msg the channel the error message
        }
      }
    }
    else {
      ;if $2 is $null
      notice $nick Please Specify a Nickname, Syntax: @dellogin <nick>
      ;msg <chan> the error message
    }
  }
}
on *:text:\addmask*:%channel:{
  ;triggers when someone types @addmask <nick>
  if ($hget(users,$nick) == $address($nick,2)) {
    ;check to see if <nick> has an address in hash table: "users"
    if ($2) {
      ;if $2 is not $null
      if ($hget(users,$2) {
        ;check to see if <nick> has an address in hash table: "users"
        hadd users $2 $address($nick,2) | notice $nick Added User: $2 - Address: $address($2,2)
        ;update the <nick>'s address in the hash table: "users"
      }
      else {
        ;if there isn't an address for <nick>
        notice $nick That user name does not exist!
        ;msg <nick> the error message
      }
    }
  }
}
on *:start: { hmake users 100 | hload users login.hsh  }
on *:exit:{ if ($hget(users)) {
    hsave -o users login.hsh
  }
}
on *:JOIN:%channel:{ notice $nick [^O] $+ ( $+ %channel $+ )[^O] [^K]2,0¨°º[^K]14©[^K]2¤[^K]2 Welcome [^K]2 [^K]0,2 [^K]2,0 - [^K]0,2 [^K]2,0 $nick to $chan  [^K]2 [^K]0,2 [^K]2,0 - [^K]0,2 [^K]2,0 Today is $date(dddd)$+ , $date(mmm) the $date(dd) $date(yyyy) type .Commands © Copyright ²ºº4 [^K]2,0¤[^K]14©[^K]2º°¨[^O] } }
on *:TEXT:.set commands*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %commands [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated Commands to %commands }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set servers*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %servers [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated servers to %servers }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set starters*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %starters [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated starters to %starters }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set roster*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %roster [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated roster to %roster }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set sponsors*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %sponsors [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated sponsors to %sponsors }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set website*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %site [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated website to %site }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set leagues*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %leagues [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated leagues to %leagues }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set news*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %news [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated news to %news }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set matches*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %matches [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 $3- [^K]14«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0[^O] | notice $nick you have just updated matches to %matches }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set channel*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %channel $3- | notice $nick you have just updated channel to %channel }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.set trigger*:%channel:{
  if ($hget(ulogin,$nick)) {
  set %trig $3- | notice $nick you have just updated channel to %trig }
  else { notice $nick Error,only admin can set this command }
}
on *:TEXT:.*:%channel:{
  if ($1 == .Commands) { notice $nick %commands }
  elseif ($1 == .News) { notice $nick %news }
  elseif ($1 == .Roster) { notice $nick %roster }
  elseif ($1 == .matches) { notice $nick %matches }
  elseif ($1 == .website) { notice $nick %site }
  elseif ($1 == .Sponsors) { notice $nick %sponsors }
  elseif ($1 == .Starters) { notice $nick %starters }
  elseif ($1 == .Servers) { notice $nick %servers }
  elseif ($1 == .channel) { notice $nick [^K]2,0.[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15· [^K]14»[^K]2 Channel set to $chan [^K]14,0«[^K]15·[^K]2´[^K]15¯[^K]2`[^K]15·[^K]14[^K]2,0.[^O] }
}
login lvls
Posted by DarkJFMan
Friday, June 11, 2004 03:04pm PDT
can you also add different login levels, where some can add ppl so they can access the bot.
darkjman
Posted by nemm91
Saturday, June 12, 2004 12:22am PDT
no not on this bot but you can add ppl you want to access the bot there is a bot like that made in old forums ircscripting but i dont like to use those cuase the scripting in it is horrible and things clash some work and some dont so its not well not for i dont really like using guser to for ppl to access bot but there is a few out there you can try .. thx what you guys think
error
Posted by Scoobster
Tuesday, June 15, 2004 03:05am PDT
when i put it in * /hload: unable to open 'C:\mirc1\login.hsh'
you have to make the login.hsh
Posted by nemm91
Tuesday, June 15, 2004 07:00pm PDT
/hmake login.hsh users 100
making login.hsh
Posted by Scoobster
Thursday, June 17, 2004 11:20pm PDT
if i type /hmake is there anything else i need to do? i dont know hash tables at all
/hmake
Posted by nemm91
Friday, June 18, 2004 04:17pm PDT
/hmake login 100
/hload ulogin.hsh
HELP
Posted by Scoobster
Sunday, June 20, 2004 12:20pm PDT
i typed /hmake log 100 and it said /hload: unable to open 'C:\Bot\login.hsh' and i typed /hload ulogin.hsh and it said insuficcient paraments
srry
Posted by nemm91
Tuesday, June 22, 2004 10:45pm PDT
thats the bug i cant get out and i tried to ask for help and got nothing so srry
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world