!rules (add/del/list)

By a careful warchild on Jan 03, 2009

Simple script where you can add|remove|list the rules, NOW WORKS FOR INDIVIDUAL CHANNELS ;)

if you add a rule in a specific channel, YOU MUST DELETE IT FROM THE CHANNEL YOU SET IT IN.

ty :)

Updated so it won't attempt to list the rules in the .ini if there are no rules there to list.
updated the error everyone kept talking about.

Any more errors, gimme a shout.

alias loc return $iif($chan,$v1,$nick)

on $*:text:/^!rules\b/Si:*:{
  tokenize 32 $strip($1-)
  if ($2 == add) && ($nick isop $chan) {
    if ($3) {
      writeini rules.ini $chan $3- Added by $nick
      msg $chan 4" $+ $3- $+ " Added as a rule by $nick $+ .
    }
  }
  if ($2 == del) && ($nick isop $chan) {
    if ($3) {
      if ($readini(rules.ini,$chan,$3)) {
        remini rules.ini $chan $3- Added By $nick
        .msg $chan 4Removed $3- from rules list.
      }
    }
    else {
      msg $chan 4No such Rule entry.
      .notice $nick 4To see the list of Rule List Entries, type !Rules <list>
    }
  }
  if ($2 == list) && ($ini(rules.ini,$chan,0)) {
    .msg $loc 4Displaying A List Of Rules For $loc $+ :
    var %a 1, %z $ini(Rules.ini,$chan,0)
    while (%a <= %z) {
      .msg $loc 04 $+ %a $ini(rules.ini,$chan,%a) $readini(rules.ini,$chan,$ini(rules.ini,$chan,%a))
      inc %a
    }
    .msg $chan 4End of list. %z entry(s) displayed.
  }
  elseif ($2 == list) && (!$ini(rules.ini,$chan,0)) {
    .msg $loc 04Sorry $nick $+ , there are currently no rules for $chan $+ .
  }
}

Comments

Sign in to comment.
Junga   -  Oct 23, 2012

how do you do that Jethro??? ANy suggestions would be great?

 Respond  
Jethro   -  Apr 19, 2010

I'll suggest this script to be rid of while loop and replace it with the /play command for the list part.

 Respond  
Sebastianjbrown   -  Apr 19, 2010

i have 12 rules and it only does 6 help!!

 Respond  
MEH   -  Mar 06, 2010

it only does 6 rules :(

can you make it do more like 20-100

LMAO

 Respond  
Spanky   -  Feb 24, 2010

Hmm nope, i tried it again Blank mirc, Still did it. o.o.

 Respond  
Spanky   -  Feb 20, 2010

LOL okay i will check altho it was tested.. on a blank mirc :/ but il test Again

 Respond  
a careful warchild   -  Feb 20, 2010

Heh. Well considering that has never done it on anyone elses but yours, that proves that it's user error. :)

(21:10:38) [~Jordan] !rules
(21:10:39) [+Atmosphere] Displaying A List Of Rules For #inspircd:
(21:10:40) [+Atmosphere] 1) Respect the ops.
(21:10:41) [+Atmosphere] 2) Don't beg for ops, they will be given to you when we are ready.
(21:10:41) [+Atmosphere] End of list. 2 entry(s) displayed.
(21:10:51) [~Jordan] !rules add Smoking kills
(21:10:51) [+Atmosphere] "Smoking kills" Added as a rule by Jordan.
(21:10:53) [~Jordan] !rules
(21:10:54) [+Atmosphere] Displaying A List Of Rules For #inspircd:
(21:10:54) [+Atmosphere] 1) Respect the ops.
(21:10:54) [+Atmosphere] 2) Don't beg for ops, they will be given to you when we are ready.
(21:10:54) [+Atmosphere] 3) Smoking kills
(21:10:54) [+Atmosphere] End of list. 3 entry(s) displayed.

:) Point proved ? :D

 Respond  
Spanky   -  Feb 20, 2010

[20:46] <~Spencer> !rules add don't flood
[20:46] <~I_HIDE> "don't flood" Added as a rule by Spencer.
[20:46] <~Spencer> !rules
[20:46] <~I_HIDE> Displaying A List Of Rules For #hidden_room_here:
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~I_HIDE> 1) Dont Spam
[20:46] <~IHIDE> 1) Dont Spam
> <_< just leaves this here.

 Respond  
a careful warchild   -  Feb 20, 2010
alias loc return $iif($chan,$v1,$nick)

on $*:text:/^!rules\b/Si:*:{
  tokenize 32 $strip($1-)
  if ($2 == add) && ($nick isop $chan) {
    if ($3) {
      writeini rules.ini $chan $3- 
      msg $chan 4" $+ $3- $+ " Added as a rule by $nick $+ .
    }
  }
  if ($2 == del) && ($nick isop $chan) {
    if ($3) {
      if ($readini(rules.ini,$chan,$3)) {
        remini rules.ini $chan $3-
        .msg $chan 4Removed $3- from rules list.
      }
    }
    else {
      msg $chan 4No such Rule entry.
      .notice $nick 4To see the list of Rule List Entries, type !Rules <list>
    }
  }
  if (!$2) && ($ini(rules.ini,$chan,0)) {
    .msg $loc 4Displaying A List Of Rules For $loc $+ :
    var %a 1, %z $ini(Rules.ini,$chan,0)
    while (%a <= %z) {
      .msg $loc 04 $+ %a $+ $chr(41) $ini(rules.ini,$chan,%a) $readini(rules.ini,$chan,$ini(rules.ini,$chan,%a))
      inc %a
    }
    .msg $chan 4End of list. %z entry(s) displayed.
  }
  elseif ($2 == list) && (!$ini(rules.ini,$chan,0)) {
    .msg $loc 04Sorry $nick $+ , there are currently no rules for $chan $+ .
  }
}

Nac, it now works for !rules

 Respond  
Nac   -  Feb 20, 2010

Yeah umm is there a way for me just to say !rules not !rules list

Help cuz other wise this sucks o.o

 Respond  
Aile   -  Oct 21, 2009

remini rules.ini $chan $3- Added By $nick <-- that line you only need remini rules.ini $chan, and in order to have this removed from anychannel, simpley do this, remini rules.ini # $+ $2 ; It will still read it as $chan because its looking to whats in it, so if you know the name, it will delete as well.

 Respond  
Renegade   -  May 01, 2009

Hold your nellies,
now this is epically late... but do tell me why I was mentioned...

thanks guys, and bullet_fag $strip works perfectly, unlike you i create my scripts for release, therefore other users who use the scripts might not want to type /ignore -k @ so stfu and go get butthurt by mikey again.

/latest ever!!!! What an achievement Q_Q

 Respond  
Spanky   -  Apr 01, 2009

iv sorta got it working :/ its not perfect but still..


alias loc return $iif($chan,$v1,$nick)

on $*:text:/^!rules\b/Si:*:{
  tokenize 32 $strip($1-)
  if ($2 == add) && ($nick isop $chan) {
    inc %rules
    if ($3) {
      writeini rules.ini $chan %rules $3- Added by $nick
      msg $chan 4" $+ $3- $+ " Added as a rule by $nick $+ .
    }
  }
  if ($2 == del) && ($nick isop $chan) {
    if ($3) {
      if ($readini(rules.ini,$chan,$3)) {
        remini rules.ini $chan $3- Added By $nick
        .msg $chan 4Removed $3- from rules list.
        dec %rules
      }
    }
    else {
      msg $chan 4No such Rule entry.
      .notice $nick 4To see the list of Rule List Entries, type !Rules <list>
    }
  }
  if ($2 == list) && ($ini(rules.ini,$chan,0)) {
    .msg $loc 4Displaying A List Of Rules For $loc $+ :
    var %a 1, %z $ini(Rules.ini,$chan,0)
    while (%a <= %z) {
      .msg $loc 04 $+ $ini(rules.ini,$chan,%a) $readini(rules.ini,$chan,$ini(rules.ini,$chan,%a))
      inc %a
    }
    .msg $chan 4End of list. %z entry(s) displayed.
  }
  elseif ($2 == list) && (!$ini(rules.ini,$chan,0)) {
    .msg $loc 04Sorry $nick $+ , there are currently no rules for $chan $+ .
  }
}

i know its not "perfect" but it works.. :)

 Respond  
Spanky   -  Mar 31, 2009

lol i know you said you're "busy" but yea do it xD or i will >.>

 Respond  
a careful warchild   -  Mar 31, 2009

Yeah yeah yeah, i know, i haven't really had the time (or in english: i havent been assed) to correct this. sorry, might do it soon.

Meh thought about it and updated. Should work, if it doesn't, give me a shout.

 Respond  
Jubbyjubbster   -  Mar 30, 2009

it dont work lol

 Respond  
Spanky   -  Jan 06, 2009

theres a problem if u do !rules add no spam then !rules add no flooding it deletes the first one.

 Respond  
a careful warchild   -  Jan 05, 2009

updated

 Respond  
Spanky   -  Jan 04, 2009

alright i like make it for specifc chans and itl be better but good work bud.

 Respond  
a careful warchild   -  Jan 04, 2009

thanks guys, and bullet_fag $strip works perfectly, unlike you i create my scripts for release, therefore other users who use the scripts might not want to type /ignore -k @ so stfu and go get butthurt by mikey again.

 Respond  
PuNkTuReD   -  Jan 04, 2009

yes it will, it says
<=
under or equal
ive never had a problem with it

 Respond  
Vox91   -  Jan 04, 2009

Perhaps you can change this:

    while (%a <= %z) { 

in to:

     while (%a  %z) { 

otherwise it will not return the last line of the ini (Last rule in this script)

 Respond  
Aucun50   -  Jan 03, 2009

"omg im not even going to explain to you how to use color commands without $strip 's" If $strip works why not use it? Also topics can explain rules but if your in a channel with like 100 people then the topic goes by fast.

 Respond  
Bullet_Dodger   -  Jan 03, 2009

omg im not even going to explain to you how to use color commands without $strip 's
This isnt to usefull aswell =/ topics can explain rules

[2/10]

 Respond  
DeathGod87   -  Jan 03, 2009

7/10

 Respond  
a careful warchild   -  Jan 03, 2009

to use it, you will need to set yourself as an auser at level 9999. or you can change the "9999" to a lower level if you wish.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.