mIRC Home    About    Download    Register    News    Help

Print Thread
#243974 14/01/14 02:37 AM
Joined: Dec 2013
Posts: 779
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Hi, I'll just let you know that I am not the best coder around, I pretty much only know the primitive methods of coding. This is why I need your assistance!

The script I made forces a user to have the bot in their channel, cause when you make her join your channel, the user gets put in a variable called %channels. And, that you are an op in the channel whom you want her to leave. However, if I have her in my channel, I can make her leave in any channel which I am an op in.

Is there a better way to solve this? So that only the very person who added her to their channel can make her leave?

This is how I wrote it:

Code:
on *:text:!leave:#: {
  if ($istok(%channels,$nick,32)) && ($nick isop #) {
    msg $chan Sayounara! 
    /leave #
    set %channels $remtok(%channels,$nick,1,32)
    echo left $chan which was initiated by $nick
  }
  else { msg $chan You do not have the required authorization to do this, $nick $+ . } 
}


on *:text:!join:#nillens: {
  if ($istok(%channels,$nick,32)) { msg $chan I am already in your channel, $nick $+ . }
  elseif (!$istok(%channels,$nick,32)) {
    /j $nick
    echo joined $nick
    set %channels $addtok(%channels,$nick,32)
  }
}


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #243982 14/01/14 03:22 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Also, took a look at my code and noticed a big flaw. (This situation won't occur unless users know of how it's coded of course) but if I am an op in someone elses chan, then if I make her leave, the %channels will remove my name cause of $nick instead of the actual $chan that she's in.


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #243990 14/01/14 10:00 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Can't edit my text, so posting another reply.

I figured out an idea which should work. However, I lack the means to make such a script.

Could someone reply with feedback on what I'm about to write now please?

First of all, let's look at this. When a user types !join in #nillens. She will join $nick. As well as put $nick in a textfile.
Upon joining their channel, she will present a message saying (bla bla) and put $chan next to the $nick in the text file.

This will make the text file look like this:

nillens #nillens
dotacinema #dotacinema
test #test
etc.

Now, the 2 conditions which must be met for the !leave is that $nick must be the same as $chan. So, if $nick writes this command, read the file and make sure $chan is the channel after $nick.

This will make sure only the user who added the bot can remove the bot.

Is this something you guys could be able to make? Cause this is way beyond my capabilities.

Looking forward to read any reply :3


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #243992 14/01/14 10:37 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
There's no need for any storage for what you've described.

Code:
on *:text:!join:#nillens: {
  if (# [ $+ [ $nick ] ] !ischan) join $v1
  else msg # I am already in your channel, $nick $+ .
}

on *:text:!leave:#: {
  if (# == # [ $+ [ $nick ] ]) {
    msg # Sayounara! 
    part #
  }
  else msg # You do not have the required authorization to do this, $nick $+ .
}

Nillen #243993 14/01/14 11:00 PM
Joined: Dec 2013
Posts: 779
N
Nillen Offline OP
Hoopy frood
OP Offline
Hoopy frood
N
Joined: Dec 2013
Posts: 779
Oh, wow. Really?

I tried so many times with making it # $+ $nick and I had no idea that [ ] could be used for such a thing.

Thank you so much!


Nillens @ irc.twitch.tv
Nillen @ irc.rizon.net
Nillen #243996 14/01/14 11:36 PM
Joined: Jan 2004
Posts: 1,358
L
Hoopy frood
Offline
Hoopy frood
L
Joined: Jan 2004
Posts: 1,358
The [ ] are a workaround to prepend # to the nick, because otherwise # would be resolved to the actual #chan first.


Link Copied to Clipboard