Warn System

By Hammer on Jun 28, 2012

As the title says, it warns somebody that does something wrong or breaks rules.

Only OPs can use it.

Please report if there is any bug!

; Warn System Beta 1.0
; By Hammer
; gs.mindfreakers.net #Hawkee
; Variable Version

on *:TEXT:!altwarn*:#: {
  if ($nick isop #) { 
    if ($2- == $null) {
      msg $chan Format : !altwarn <Nickname> - Will Increase Warn Level of Given Nickname [Max Level : 10].
      halt
    }
    if (%WarnLevel. [ $+ [ $2 ] ] == 10) { 
      msg $chan $2 Has 10 Warns Already. 
      halt 
    }
    if ($3 > 10) { msg $chan The Level Must Be Less Than 10 }
    else { 
      INC %WarnLevel. [ $+ [ $2 ] ] $3
      if ($3 == $null) {
        msg $chan Warn Level of $2 Has Been Increased By 1.
        if (%WarnLevel. [ $+ [ $2 ] ] == 10) { 
          msg $chan $2 Has 10 Warns Now. 
        }
      }
      else {
        msg $chan Warn Level of $2 Has Been Increased By $3.
        if (%WarnLevel. [ $+ [ $2 ] ] == 10) { 
          msg $chan $2 Has 10 Warns Now. 
        }
      }
    }
  }
  else {
    msg $chan You're Not An Operator. You Cannot Use This Command.
  }
}
on *:TEXT:!decwarn*:#: {
  if ($nick isop #) {
    if ($2- == $null) {
      msg $chan Format : !decwarn <Nickname> <Level> - Will Decrease Warn Level of Given Nickname.
      halt
    }
    DEC %WarnLevel. [ $+ [ $2 ] ] $3
    if ($3 == $null) {
      msg $chan Warn Level of $2 Has Been Decreased By 1.
    }
    else {
      msg $chan Warn Level of $2 Has Been Decreased By $3.
    }
  }
  else {
    msg $chan You're Not An Operator. You Cannot Use This Command.
  }
}
on *:TEXT:!showwarn*:#: {
  if ($nick isop #) {
    if ($2- == $null) {
      msg $chan Format : !showwarn <Nickname> - Will Show Warn Level of Given Nickname.
      halt
    }
    if (%WarnLevel. [ $+ [ $2 ] ] == $null) {
      msg $chan $2 Has 0 Warn(s).
    }
    else {
      msg $chan $2 Has %WarnLevel. [ $+ [ $2 ] ] Warn(s).
    }
  }   
  else {
    msg $chan You're Not An Operator. You Cannot Use This Command.
  }
}

; INI File Version

on *:TEXT:!altwarn*:#: {
  if ($nick isop #) { 
    if ($2- == $null) {
      msg $chan Format : !altwarn <Nickname> - Will Increase Warn Level of Given Nickname [Max Level : 10].
      halt
    }
    if ($readini(Warns.ini,n,Warns,$2) == 10) { 
      msg $chan $2 Has 10 Warns Already. 
      halt 
    }
    if ($3 > 10) { msg $chan The Level Must Be Less Than 10 }
    else { 
      set %warn $readini(Warns.ini,n,Warns,$2)
      INC %warn $3
      writeini Warns.ini Warns $2 %warn
      unset %warn
      if ($3 == $null) {
        msg $chan Warn Level of $2 Has Been Increased By 1.
        if ($readini(Warns.ini,n,Warns,$2) == 10) { 
          msg $chan $2 Has 10 Warns Now. 
        }
      }
      else {
        msg $chan Warn Level of $2 Has Been Increased By $3.
        if ($readini(Warns.ini,n,Warns,$2) == 10) { 
          msg $chan $2 Has 10 Warns Now. 
        }
      }
    }
  }
  else {
    msg $chan You're Not An Operator. You Cannot Use This Command.
  }
}
on *:TEXT:!decwarn*:#: {
  if ($nick isop #) {
    if ($2- == $null) {
      msg $chan Format : !decwarn <Nickname> <Level> - Will Decrease Warn Level of Given Nickname.
      halt
    }
    else {
      set %warn $readini(Warns.ini,n,Warns,$2)
      DEC %warn $3
      writeini Warns.ini Warns $2 %warn
      unset %warn
      if ($3 == $null) {
        msg $chan Warn Level of $2 Has Been Decreased By 1.
      }
      else {
        msg $chan Warn Level of $2 Has Been Decreased By $3.
      }
    }
  }
  else {
    msg $chan You're Not An Operator. You Cannot Use This Command.
  }
}
on *:TEXT:!showwarn*:#: {
  if ($nick isop #) {
    if ($2- == $null) {
      msg $chan Format : !showwarn <Nickname> - Will Show Warn Level of Given Nickname.
      halt
    }
    if ($readini(Warns.ini,n,Warns,$2) == $null) {
      msg $chan $2 Has 0 Warn(s).
      halt
    }
    elseif ($readini(Warns.ini,n,Warns,$2) != $null) {
      msg $chan $2 Has $readini(Warns.ini,n,Warns,$2) Warn(s).
      halt
    }
  }   
  else {
    msg $chan You're Not An Operator. You Cannot Use This Command.
  }
}

Comments

Sign in to comment.
Jethro   -  Jul 16, 2012

You can consolidate those separate text events into one to minimize the repetitions.

 Respond  
baloe12nl   -  Jul 14, 2012

I have a sugestion:

add this to the code

;------------->>  Variable Version

on *:join:#: {
  if ( $nick == %WarnLevel. [ $+ [ $nick ] ] ) {
    if ( %WarnLevel. [ $+ [ $nick ] ] >= 5 ) .notice $nick $nick you have %WarnLevel. [ $+ [ $nick ] ] warns now | .notice $nick your warn level must be less than 10.
    else .notice $nick $nick you have %WarnLevel. [ $+ [ $nick ] ] Warn(s).
  }
  else (%WarnLevel. [ $+ [ $nick ] ] == $null) .notice $nick you have 0 Warn(s).
}

;------------->> INI File Version

on *:join:#: {
  if ( $nick == $readini(Warns.ini,n,Warns,$nick) ) {
    if ( $readini(Warns.ini,n,Warns,$nick) >= 5 ) .notice $nick $nick you have $readini(Warns.ini,n,Warns,$nick) warns now | .notice $nick your warn level must be less than 10.
    else .notice $nick $nick you have $readini(Warns.ini,n,Warns,$nick) Warn(s).
  }
  else ( $readini(Warns.ini,n,Warns,$nick) == $null) .notice $nick you have 0 Warn(s).
}

THis way the people know hawe many warning points they have, ore not.

 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.