INI User System
Posted by Technique
Wednesday, July 19, 2006
Description: meh

Alot of people always ask me to make them a Bot for there club like Main-Train.

Im sure alot of you have got the same requests well Ive decided that I would make
1 but insted of using Hash Tables which was the original plan I decided to use INI's.

I just started this today and its been tested and works. Still adding alot more features but as i said this is my project to be completed soon. If you have any idea's to throw in then please do mention :)


;;INI User System
;;Created By Technique
;;technique420@gmail.com

alias joincmds {
  if ($readini(Users.ini,Ops,$nick)) {
    mode %chan +o $nick
  }
  if ($readini(Users.ini,Masters,$nick)) {
    mode %chan +o $nick
  }
  if ($readini(Users.ini,Owner,$nick)) {
    mode %chan +o $nick
  }
  if ($readini(Users.ini,Coowners,$nick)) {
    mode %chan +o $nick
  }
  if ($readini(Users.ini,Peons,$nick)) {
    mode %chan +v $nick
  }
}

alias nickchange {
  if ($readini(Users.ini,Ops,$nick)) {
    remini Users.ini Ops $nick $address($nick,2)
    writeini Users.ini Ops $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Masters,$nick)) {
    remini Users.ini Masters $nick $address($nick,2)
    writeini Users.ini Masters $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Owner,$nick)) {
    remini Users.ini Owner $nick $address($nick,2)
    writeini Users.ini Owner $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Coowners,$nick)) {
    remini Users.ini Coowners $nick $address($nick,2)
    writeini Users.ini Coowners $newnick $address($newnick,2)
  }
  if ($readini(Users.ini,Peons,$nick)) {
    remini Users.ini Peons $nick $address($nick,2)
    writeini Users.ini Peons $newnick $address($newnick,2)
  }
}

alias startup {
  writeini Users.ini Owner $me $address($me,2)
  echo -a You have been added as the owner.
}

alias addchan {
  set %chan $1
  echo -a Channel Added.
}

alias addowner {
  writeini Users.ini Owner $1 $address($1,2)
  echo -a Added $1 $+ .
}

alias addco {
  writeini Users.ini Coowners $1 $address($1,2)
  echo -a Added $1 $+ .
}

on *:NICK:{
  nickchange
}

on *:JOIN:#:{
  joincmds
}

on *:TEXT:.addop*:#:{
  if ($nick isop $chan) {
    if ($readini(Users.ini,Owner,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Coowners,$nick)) {
      if (!$2) {
        notice $nick Invalid Syntax: .addop NAMEHERE
        halt
      }
      if ($2 !ison $chan) {
        notice $nick Error: $2 is not in $chan $+ .
        halt
      }
      if ($readini(Users.ini,Ops,$2)) {
        notice $nick Error: $2 is already on the userlist.
        halt
      }
      else {
        writeini Users.ini Ops $2 $address($2,2)
        notice $nick Success: $2 has been added to the userlist.
        mode $chan +o $2
      }
    }
    else {
      notice $nick You dont have anough access to use this command.
      halt
    }
  }
}

on *:TEXT:.delop*:#:{
  if ($nick isop $chan) {
    if ($readini(Users.ini,Owner,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Masters,$nick)) || ($readini(Users.ini,Coowners,$nick)) {
      if (!$2) {
        notice $nick Invalid Syntax: .delop NAMEHERE
        halt
      }
      if ($2 !ison $chan) {
        notice $nick Error: $2 is not in $chan $+ .
        halt
      }
      if (!$readini(Users.ini,Ops,$2)) {
        notice $nick Error: $2 is not on the userlist.
        halt
      }
      else {
        remini Users.ini Ops $2 $address($2,2)
        notice $nick Success: $2 has been deleted from the userlist
        mode $chan -o $2
      }
    }
    else {
      notice $nick You dont have anough access to use this command.
      halt
    }
  }
}

on *:TEXT:.access*:#:{
  if ($nick isop $chan) || ($nick isvoice $chan) {
    if (!$2) {
      if ($readini(Users.ini,Peons,$nick)) {
        notice $nick Access: 100
        halt
      }
      if ($readini(Users.ini,Ops,$nick)) {
        notice $nick Access: 200
        halt
      }
      if ($readini(Users.ini,Masters,$nick)) {
        notice $nick Access: 300
        halt
      }
      if ($readini(Users.ini,Coowners,$nick)) {
        notice $nick Access: 400
        halt
      }
      if ($readini(Users.ini,Owner,$nick)) {
        notice $nick Access: 500
        halt
      }
    }
    else {
      if ($readini(Users.ini,Peons,$2)) {
        notice $nick Access for $2 $+ : 100
        halt
      }
      if ($readini(Users.ini,Ops,$2)) {
        notice $nick Access for $2 $+ : 200
        halt
      }
      if ($readini(Users.ini,Masters,$2)) {
        notice $nick Access for $2 $+ : 300
        halt
      }
      if ($readini(Users.ini,Coowners,$2)) {
        notice $nick Access for $2 $+ : 400
        halt
      }
      if ($readini(Users.ini,Owner,$2)) {
        notice $nick Access for $2 $+ : 500
        halt
      }
    }
  }
}


The INI File(If people dont already know how to set it up)


[Owner]

[Coowners]

[Masters]

[Ops]

[Peons]


Start up commands:
/startup <-- Sets your name and hostmask under owner.
/addowner NAME <-- Adds the person you put as an owner
/addco NAME <-- Adds the person you put as a coowner
/addchan CHAN <-- Set your channel

Remember im still adding more features. Like CLVL addmaster etc etc just had to get it up to test :P.
Security
Posted by Sky
Tuesday, November 14, 2006 03:59am PST
Anybody can use any nick hence why you should use peoples auth's

instead of adding them as $Nick try
$gettok($gettok($address($nick,1),2,$asc(@)),1,$asc(.))

this will store there auth not there nickname ;)

Alot safer imo.
Submit a comment
Oops! You need to login or register before you can post a comment!

ebaum's world