mIRC Home    About    Download    Register    News    Help

Print Thread
#137977 22/12/05 07:30 PM
Joined: Apr 2005
Posts: 64
V
Vinniej Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Apr 2005
Posts: 64
Hi there,

First of all, I hope you can help me.

I'm making a new bot for a friend of me, he want some userlevels:

Code:
; 1 (Normal user)
; 10 (Channel admin)
; 100 (Channel master)
; 1000 (Bot master)


I have this code to add userlevels to the userlist:

Code:
on 1000:text:.adduser * *:#: {
  if ($3 == 1000) { auser 1000 $address($2,1)
  notice $nick --» Done. }
  elseif ($3 == 100) { auser 100 $+ $chan $address($2,1)
  notice $nick --» Done. }
  elseif ($3 == 10) { auser 10 $+ $chan $address($2,1)
  notice $nick --» Done. }
  else notice $nick --» Unknown Userlevel.
} 


And yes, it works, so far. After adding a useron level 100, you will get this in the userlist:

Code:
 100#chan:*!*Identd@hostname.ext 


But, when that user joins #lol, the bots says that user is a channelmaster. But he's only a channelmaster of #chan, so he may not have the permissions for #lol.

I've this code to detect a user with userlevel 100

Code:
 on 100$chan:join:#: {
  msg $chan --» Channel master (Level 100) $nick joined $chan $+ ! (Typ .op)
}
on 100$chan:text:.op:#: {
  mode $chan +o $nick
}
 


confused

#137978 22/12/05 09:16 PM
Joined: Jun 2005
Posts: 127
H
Vogon poet
Offline
Vogon poet
H
Joined: Jun 2005
Posts: 127
Unless i seriously overlooked something, im pretty sure #channel names cant be used in user levels. Only the level can. However, you can specify the channel on the remote event, such as your on text event.

The only thing i can think of is using seperate user levels for different chans. Level 10 could be #chan1 and level 15 #chan2. I suppose you could use hash tables to make a more detailed user list, involving sperate channels. If that's the route you'd like to take, let me know and ill help you set it up.

----------------------------------

DOH! Ok, forget all that [censored] i just said. I didnt read your post too carefully. Now i see how you have it. In your on text event, in the 'on 100$chan' $chan isnt being evaluated. It's being treated as plain text. So you need to use wildcard at the userlevel, then check later on in the script using $level.
Try this:

Code:
on *:text:!op*:#channel: {
  ;simple !op command.  You want it limited to level 10...
  var %x = $gettok($level($address($nick,2)),1,35)
  ; ^^ This is the numerical user level saved in %x (10,100,etc)
  if ($+($chr(35),$gettok($level($address($nick,2)),2,35)) == $chan) {
    ;Checks if the channel on that nick's user level the same as this channel
    if (%x == 10) {
      mode $chan +o $2
      ; If their level is 10, do op command
    }
    else {
      msg $chan No access for $nick
    }
  }
}


With this, you should be able to keep your user lists as they are. You just need a seperate on text event for each channel, at least in this example. There is a way to combine it into 1. If you're interested in thatl let me know.

Good luck.

Last edited by HAMM3R; 22/12/05 09:31 PM.
#137979 22/12/05 09:39 PM
Joined: Apr 2005
Posts: 64
V
Vinniej Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Apr 2005
Posts: 64
I want a full automatical bot, so if I add a channel, I don't want to copy/paste or change anything in the code. I have 2 bots were I have to do that, but I know it's annoying if you don't have time enough.

Second, this bot is for a person who don't know anything about irc scripting, so it would be handy if it's automatically.

I've tried the following thing also:

Code:
 on 100 $+ $chan:join:#: {
  msg $chan --» Channel master (Level 100) $nick joined $chan $+ ! (Typ .op)
} 

and this one:

Code:
 on 100 $+ $chan $+ :join:#: {
  msg $chan --» Channel master (Level 100) $nick joined $chan $+ ! (Typ .op)
} 

Last edited by Vinniej; 22/12/05 09:46 PM.
#137980 23/12/05 12:29 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
if you have one bot running user levels in multiple channels you #1 need to have the channel as part of the userlevel and #2 should use the channel in the on join event
on +lol100:join:#lol:{ mode $chan +o $nick }
on +lol50:join:#lol:{ mode $chan +h $nick }

on +masters100:join:#masters:{ mode $chan +o $nick }
on +masters50:join:#masters:{ mode $chan +h $nick }

#137981 23/12/05 01:57 AM
Joined: Apr 2005
Posts: 64
V
Vinniej Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Apr 2005
Posts: 64
So I always have to change or add some code if I add a channel? mad

#137982 23/12/05 04:09 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
no you can use user levels differently than I showed.
you are planning on having this bot in a lot of channels?
if yes, look at hash tables.

#137983 23/12/05 04:28 AM
Joined: Apr 2005
Posts: 64
V
Vinniej Offline OP
Babel fish
OP Offline
Babel fish
V
Joined: Apr 2005
Posts: 64
I have space for 20 channels (Quakenet). So it will idle in 20 chans. Can someone make a example, because I don't know for 100% what you mean... smile

#137984 23/12/05 06:59 AM
Joined: Dec 2002
Posts: 1,245
M
Hoopy frood
Offline
Hoopy frood
M
Joined: Dec 2002
Posts: 1,245
try this
Code:
alias hashtest {
  hfree authlist
  hmake -s authlist 20
  hadd authlist 100
  hadd authlist 50
  hadd authlist 20

  ;add a user #chan1 at 100
  hadd authlist 100 #chan1 dave*!@123.com

  ; add another user to #chan1 100 
  var %temp = $hget(authlist,100)
  hadd authlist 100 #chan1 elsie@milk.com %temp

  ;add same user to #chan2 50 
  var %temp2 = $hget(authlist,50)
  hadd authlist 50 #chan2 elsie@milk.com %temp2

  hsave authlist authlist.txt
  run notepad authlist.txt
}
alias simjoin {
  ;var %joined = $+(*,$chan $address($nick,1),*) 

  var %joined = $+(*,#chan1 elsie@milk.com,*)

  var %test100 = $hget(authlist,100)
  if ($(%joined,2) iswm %test100) { echo -s mode $!chan +o $!nick | return }

  var %test50 = $hget(authlist,50)

  if ($(%joined,2) iswm %test50) { echo -s mode $!chan +h $!nick | return }

  var %test20 = $hget(authlist,20)
  if ($(%joined,2) iswm %test20) { echo -s mode $!chan +v $!nick | return }

  else { echo -s Welcome to $!chan $!nick $+ $chr(44) enjoy your visit }
}

alias adduser {
var %channel = $?="Enter Channel Name"
var %Nickname = $?="Enter users ADDRESS $crlf in the form $crlf *!*user@host.com
var %Level = $?="Enter access level"
var %current = $hget(authlist,%level)
hadd authlist %level %channel %nickname %current
echo -s Added Level %level on Address %nickname fo Channelr %channel
}


see if it gives you any ideas


Link Copied to Clipboard