mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2014
Posts: 7
J
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
J
Joined: Jan 2014
Posts: 7
I have a simple quotebot running in a channel and I wish to ban some people from using the command, the command in question is:

Quote:
on *:TEXT:!addquote *:#:{ write quotesreview.txt $nick : $2- } { msg $chan Quote added for review }


I want to have a text file that I can add banned users to a list in a text instead of doing an if statement and I was wondering how I would go about doing that. Any help is very appreciated.

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Hello,

From some help on a script I currently have give this ago and see how it work for you. You didn't say who would be allowed to ban users from adding scripts, so on the two parts where it says NICKNAME change this to your mIRC nickname and it will allow you to ban users from adding quotes.

to ban or delete a user from making quotes you must message the bot or person who will have the script in the mIRC.

/msg nickname addban username
/msg nickname delban username

Adding or Deleting the person from the ban list will notify them on the action..... Again you didn't say if you wanted it to tell them if there banned or unbanned but I can easily change this.

If you don't want to do it via pm message I can make it a room command !addban nickname etc I can also make it so if you have staff who will need access to the ban list to make a simple command to allow or deny them access also.

Code:
on *:Text:*banuser*:?: {
  if ($1 == banuser) && ($nick == NICKNAME) {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ banuser <nick> | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I will not add myself. | halt }
      if ($readini(banned.ini, $2, Level) !== $null) { .notice $nick $2 is already in the quotes ban list. | halt }
      if ($comchan($2,0) == 0) { .notice $nick $2 is not on any of my channels. To add a user you must bring them to a channel were I am too. | halt }
      else { 
        writeini -n banned.ini $2 Level Banned
        writeini -n banned.ini $2 Num 200
        writeini -n banned.ini $2 Hostmask $mask($address($2,2),2)
        .guser 200 $2 2
        .msg $2 You have been banned from adding quotes by $nick
        .notice $nick You have banned $2 from adding quotes.
      }
    }
  }
}
on *:text:*delban*:?: {
  if ($1 == delban) && ($nick == NICKNAME) {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ delban <nick>. | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I'm not listed on that list :). | halt }
      if ($readini(banned.ini, $2, Level) == $null) { .notice $nick $2 doesn't appear to be on the ban list. | halt }
      else {
        .ruser 200 $readini(banned.ini, $2, Hostmask)
        .remini banned.ini $2
        .write -ds $+ $2 banned.txt 
        .notice $nick has been removed from the quotes ban list.
        .msg $2 You have removed from the quotes ban list. You may now add quotes 
      }
    }
  }
}
on *:TEXT:!addquote*:#:{ 
  if ($level($mask($address($nick,2),2)) == 200) { .notice $nick Sorry you can not add a quote as you have been banned. }
  else {
  write quotesreview.txt $nick : $2- } { .msg $chan Quote added for review }
}


Let me know if you need anything changing and ill see what I can do smile

Hope its ok for you


Regards

JayStew
Joined: Jan 2014
Posts: 7
J
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
J
Joined: Jan 2014
Posts: 7
Thank you so much! Thought I would prefer to have it using room commands, I will be the only person adding users to the list and I would prefer if it only told them once they tried to use the command again

Thank you again for your help! I hope am not being to demanding xD

Last edited by JerichoGCN; 05/01/14 04:43 AM.
Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Hi

The below will now work as room commands !banuser nickname !delban nickname and !addquote quote. Ive also removed it so if you do !banuser nickname it wont message them and tell them. They will only know when they try and add a quote.

Although will this be going into a bot mIRC or are you placing it into your own mIRC - As this will work fine in a bot but if you are planning to place this in your own mIRC then you would not be able to use it as a room commands as the the on text triggers wont be triggered from the same client. If you are going to place into your own mIRC then it would have to be made so you would type /banuser nick name rather than a room command.


Code:
on *:Text:*!banuser*:#: {
  if ($1 == !banuser) && ($nick == NICKNAME) {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ banuser <nick> | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I will not add myself. | halt }
      if ($readini(banned.ini, $2, Level) !== $null) { .notice $nick $2 is already in the quotes ban list. | halt }
      if ($comchan($2,0) == 0) { .notice $nick $2 is not on any of my channels. To add a user you must bring him to a channel were I am too. | halt }
      else { 
        writeini -n banned.ini $2 Level Banned
        writeini -n banned.ini $2 Num 200
        writeini -n banned.ini $2 Hostmask $mask($address($2,2),2)
        .guser 200 $2 2
        .notice $nick You have banned $2 from adding quotes
      }
    }
  }
}
on *:text:*!delban*:#: {
  if ($1 == !delban) && ($nick == NICKNAME) {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ delban <nick>. | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I'm not listed on that list :). | halt }
      if ($readini(banned.ini, $2, Level) == $null) { .notice $nick $2 doesn't appear to be on the ban list. | halt }
      else {
        .ruser 200 $readini(banned.ini, $2, Hostmask)
        .remini banned.ini $2
        .notice $nick  $2 been removed from my quotes ban list.

      }
    }
  }
}
on *:TEXT:!addquote*:#:{ 
  if ($level($mask($address($nick,2),2)) == 200) { .notice $nick Sorry you can not add a quote as you have been banned. }
  else {
  write quotesreview.txt $nick : $2- } { msg $chan Quote added for review }
}



Also it might be worth telling you that this way will also only work if the person is in the same room as the person holding the script. So say if you have it in your bot and your in channel staff and your bot is in channel staff and lobby. if you want to ban someone called jack and do !banuser jack the bot will check channels staff and lobby if that name is in the list it will ban them, if jack isn't in any room with the bot then it wont ban them.

This is because ive asked it to ban the hostmark / address of the username with nick, I can make it so it will ban the person when not in the room but it would only ban the nickname so if I banned nickname jack only then somebody totally different joined the room with the name jack it also wouldn't let them as it would just be going off the nick and not the user host mark.

Last edited by jaystew; 05/01/14 12:25 PM.

Regards

JayStew
Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Whilst ive had the type...... if your going to use it in your own mIRC client then I have changed it so you can. If you use this one then there is no NICKNAME to change as its in your client and being done by /commands then no-one else can trigger it.

Commands are:

/banuser nickname
/delban nickname
/addquote (you can add quotes this way)
!addquotes (public room command for other users)

Code:
alias banuser {
  if ($1 == $null) { .echo Command incomplete. Syntax: %c $+ /banuser <nick> | halt }
  if ($1 !== $null) {
    if ($1 == $me) { .echo I will not add myself. | halt }
    if ($readini(banned.ini, $1, Level) !== $null) { .echo $1 is already in the quotes ban list. | halt }
    if ($comchan($2,0) == 0) { .echo $2 is not on any of my channels. To add a user you must bring him to a channel were I am too. | halt }
    else { 
      writeini -n banned.ini $1 Level Banned
      writeini -n banned.ini $1 Num 200
      writeini -n banned.ini $1 Hostmask $mask($address($1,2),2)
      .guser 200 $1 2
      .echo You have banned $1 from adding quotes
    }
  }
}
alias delban {
  if ($1 == $null) { .echo Command incomplete. Syntax: %c $+ /delban <nick>. | halt }
  if ($1 !== $null) {
    if ($1 == $me) { .echo I'm not listed on that list :). | halt }
    if ($readini(banned.ini, $1, Level) == $null) { .echo $1 doesn't appear to be on the ban list. | halt }
    else {
      .ruser 200 $readini(banned.ini, $1, Hostmask)
      .remini banned.ini $1
      .echo $1 has been removed from my quotes ban list.

    }
  }
}
alias addquote {
  if ($level($mask($address($1,2),2)) == 200) { .echo Sorry you can not add a quote as you have been banned. }
  else {
  write quotesreview.txt $me : $1- } { msg $chan Quote added for review }
}
on *:TEXT:!addquote*:#:{ 
  if ($level($mask($address($1,2),2)) == 200) { .notice $nick Sorry you can not add a quote as you have been banned. }
  else {
  write quotesreview.txt $nick : $2- } { msg $chan Quote added for review }
}


If you don't like the command names e.g. /banuser find these names in the script and change them to your preferred wording, just make sure if you change banuser to say quoteban make sure you change all the parts that say banuser to the new word.

Enjoy laugh


Regards

JayStew
Joined: Jan 2014
Posts: 7
J
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
J
Joined: Jan 2014
Posts: 7
I would hate to be a bother but can you make it so it uses the names so I can ban when they are outside the room? I am running in a Twitch room so all the users are unique (Which I should've mentioned before, sorry)

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Sure i'll have to look later when I have finished work.... Which way are you using the script !banuser (placing script in bot) or the /banuser (placing script in your mIRC)



Regards

JayStew
Joined: Jan 2014
Posts: 7
J
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
J
Joined: Jan 2014
Posts: 7
!banuser Thank you again

Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Hey

Ok so I think I have managed to do what you have asked for and I have added a play feature to show you the current ban list. It uses the /play command so it will not have your bot kicked for flooding.

First of all in your mIRC directory folder create a new folder called QuoteScript and then upload the script to your mIRC. This will then place all ban lists and Quotes for review in the folder called QuoteScript (will keep your mIRC tidy).

Remember to change the NICKNAME to your IRC nickname.

Commands are:

!banuser nickname - Bans a nickname
!delban nickname - Removes ban for the nickname
!showbans - Will show all names in the ban list (This will only show to you and no-one else.
!addquote quote - Adds quote to review file.

Code:
 
on *:Text:*!banuser*:#: {
  if ($1 == !banuser) && ($nick == NICKNAME) {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ !banuser <nick> | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I will not add myself. | halt }
      if ($readini(QuoteScript\Banned.ini, $2, Level) !== $null) { .notice $nick $2 is already in the quotes ban list. | halt }
      else { 
        .writeini -n QuoteScript\Banned.ini $2 Level Banned
        .write QuoteScript\BanList.txt $2
        .notice $nick You have banned $2 from adding quotes
      }
    }
  }
}
on *:text:*!delban*:#: {
  if ($1 == !delban) && ($nick == NICKNAME) { 
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ delban <nick>. | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I'm not listed on that list :). | halt }
      if ($readini(QuoteScript\Banned.ini, $2,Level) == $null) { .notice $nick $2 doesn't appear to be on the ban list. | halt }
      else {
        .remini QuoteScript\Banned.ini $2
        .write -dl,$2 QuoteScript\BanList.txt
        .notice $nick $2 has been removed from my quotes ban list.

      }
    }
  }
}
on *:text:*!showbans*:#: {
  if ($1 == !showbans) && ($nick == NICKNAME) { 
    if ($1 == $null) { .notice $nick Command incomplete. Syntax: %c $+ !showbans | halt }
    if ($exists(QuoteScript\BanList.txt) == $false) { .notice $nick Sorry but there are no banned names to show. | halt }
    else {
      .notice $nick The following people have been banned from adding quotes.
      .play -n $nick QuoteScript\Banned.txt
    }
  }
}
on *:TEXT:!addquote*:#:{ 
  if ($readini(QuoteScript\Banned.ini, $nick, Level) !== $null)  { .notice $nick Sorry you can not add a quote as you have been banned. }
  else {
  .write QuoteScript\QuotesReview.txt $nick : $2- } { msg $chan Your quote has been added for review }
}



smile


Regards

JayStew
Joined: Jan 2014
Posts: 7
J
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
J
Joined: Jan 2014
Posts: 7
That is perfect! Thanks a bundle my friend, sorry I was so demanding xD

Joined: Jan 2014
Posts: 7
J
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
J
Joined: Jan 2014
Posts: 7
Sorry to double post but I am having a few issues anything that is using .notice or .play is not working, also !delban is not working it says that the user is not on the list even if they are.
The .notice problem can be fixed if it is changed to msg $chan though the other issues I can't work out
Also the !showbans command cannot be used on twitch because if to many messages are sent in a short period the user is banned but I can live without the command xD

Sorry for all the troublr

Last edited by JerichoGCN; 07/01/14 03:03 PM.
Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Hey

Is their any error messages on the mIRC status window when the .notice issues occurs? What are you trying to do when it happens? The .play command is only being used by the !showbans so as you can not use that command then the !showbans can just be removed.

I have copied and pasted the last code I posted into my bot's mIRC and everything seems to be working fine with no error messages and everything is working as it should.

Just to also confirm that you created a new yellow folder in mIRC folder called QuoteScript (case sensitive) and that the actual script is being place into a bots mIRC client and not yours.

I have reposted the latest version of the script and removed the !showbans to also make sure something didn't go wrong somewhere and I pasted or yourself copied.

Code:
on *:Text:*!banuser*:#: {
  if ($1 == !banuser) && ($nick == NICKNAME) {
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ !banuser <nick> | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I will not add myself. | halt }
      if ($readini(QuoteScript\Banned.ini, $2, Level) !== $null) { .notice $nick $2 is already in the quotes ban list. | halt }
      else { 
        .writeini -n QuoteScript\Banned.ini $2 Level Banned
        .write QuoteScript\BanList.txt $2
        .notice $nick You have banned $2 from adding quotes
      }
    }
  }
}
on *:text:*!delban*:#: {
  if ($1 == !delban) && ($nick == NICKNAME) { 
    if ($2 == $null) { .notice $nick Command incomplete. Syntax: %c $+ delban <nick>. | halt }
    if ($2 !== $null) {
      if ($2 == $me) { .notice $nick I'm not listed on that list :). | halt }
      if ($readini(QuoteScript\Banned.ini, $2,Level) == $null) { .notice $nick $2 doesn't appear to be on the ban list. | halt }
      else {
        .remini QuoteScript\Banned.ini $2
        .write -dl,$2 QuoteScript\BanList.txt
        .notice $nick $2 has been removed from my quotes ban list.

      }
    }
  }
}
on *:TEXT:!addquote*:#:{ 
  if ($readini(QuoteScript\Banned.ini, $nick, Level) !== $null)  { .notice $nick Sorry you can not add a quote as you have been banned. }
  else {
  .write QuoteScript\QuotesReview.txt $nick : $2- } { msg $chan Your quote has been added for review }
}


Let me know how it goes

Thanks


Regards

JayStew
Joined: Jan 2014
Posts: 55
J
Babel fish
Offline
Babel fish
J
Joined: Jan 2014
Posts: 55
Hey

Did it work out ok in the end?



Regards

JayStew

Link Copied to Clipboard