mIRC Homepage
Posted By: Nillen on text LEAVE - 14/01/14 02:37 AM
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)
  }
}
Posted By: Nillen Re: on text LEAVE - 14/01/14 03:22 PM
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.
Posted By: Nillen Re: on text LEAVE - 14/01/14 10:00 PM
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
Posted By: Loki12583 Re: on text LEAVE - 14/01/14 10:37 PM
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 $+ .
}
Posted By: Nillen Re: on text LEAVE - 14/01/14 11:00 PM
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!
Posted By: Loki12583 Re: on text LEAVE - 14/01/14 11:36 PM
The [ ] are a workaround to prepend # to the nick, because otherwise # would be resolved to the actual #chan first.
© mIRC Discussion Forums