'Jailing' system

By Lindrian on Jan 24, 2007

This is a script i was working on, to have control and a nice overview of the users in the game that im playing, which supports a jailing function. And since we all use mirc, i thought this would be a great idea.
Its simple as it is, .jail and .unjail . And ofcourse you're able to view the lists etc.

This aint only for "jails", it can be used for other stuff, the only stuff you would need to change is the trigger and the texts.

!Special thanks to LO_KEY, for doing the finals, and checking through!

Edit: Added with the help of LO_KEY a ammount of time aswell. now you type ".jail " :]

Edit: Added the function to jail someone in minutes instead, since that was a bit mroe usfull for me.
So, incase you want to use minutes instead of seconds, change line (32) from (var %timer = $3) to (var %timer = $3 * 60) and line (34) from '(' ( $+ $duration($3) $+ ). ')' to '(' ( $+ $duration(%timer,$3) $+ ). ')'

I hope you guys will enjoy this script just as much as I am :p

EDIT:
Updated the script with a function so it shows who jailed the user, and also if a reason was input, it shows that.

Also added a clear function, incase the file is full or you simply have too many jailed :)

HF

menu channel {
  Jailing overview system $iif(%jail, $+($chr(40),$v1,$chr(41)), (None))
  .$iif(%jail,Change, Set jaling overview channel):set -s %jail #$$?="Enter the #Channel:"
}
on *:TEXT:.*:%jail: {
  if ( .jailsys == $1 ) {
    if ( $2 == on ) {
      if ($nick !isop #) {
        msg # ( $+ $nick $+ ), You do not have the authority to do this
        goto end
      }
      if (!$readini(jail.ini,conf,stat)) { writeini jail.ini conf stat 1
        msg $chan Jailing overview enabled!
        msg $chan Jailing overview for ( $+ $chan $+ ) is now in session.
      }
      else msg # ( $+ $nick $+ ) the jailing overview is already enabled.
    }
    elseif ( $2 == off ) {
      if ($nick !isop #) {
        msg # ( $+ $nick $+ ), You do not have the authority to do this
        goto end
      }
      if ($readini(jail.ini,conf,stat)) {
        .remove jail.ini
        msg $chan Jailing overview disabled!
        msg $chan Jailing overview for ( $+ $chan $+ ) is NOT in session!
      }
      else { msg # ( $+ $nick $+ ) the jailing overview is already disabled. }
    }
    elseif ($nick !isop $chan) { msg # ( $+ $nick $+ ), You do not have authority to do that action. }
  }
  elseif ( $1 == .jail ) {
    if ($nick !isop #) {
      msg # ( $+ $nick $+ ), You do not have the authority to do this
      goto end
    }
    if ($readini(jail.ini,conf,stat)) {
      if ($readini(jailuser.ini, Jail, $2)) {
        msg # Sorry $+($nick,$chr(44)) $2 is already Jailed
        goto end
      }
      elseif (!$readini(jailuser.ini, Jail, $2)) {
        writeini jailuser.ini jail $2 $nick $iif($4-,$4-,-NONE-) $chr(32) 
        var %reason = $4-
        ;write jail2.txt $nick
        ;write jail2.txt $4-
        var %timer = $3 * 60
        if (%timer isnum) {
          msg # The requested user ( $+ $2 $+ ) will now be jailed for ( $+ $duration(%timer,$3) $+ ) by $nick $+ , Reason: $iif($4-,$4-,-NONE-)
          $+(.timer,$2,unjailini) 1 %timer remini jailuser.ini jail $2
          $+(.timer,$2,unjailmsg) 1 $calc(%timer + 1) msg $chan The user ( $+ $2 $+ ) shall now be unjailed. 
        }
        if ($3 !isnum) {
          msg # The requested user ( $+ $2 $+ ) will now be jailed for an Unspecified amount of time, with the reason: $iif($4-,$4-,-NONE-)
        }
      }
      else { 
        msg # Insufficient Parameters: .jail 'The user that shall be jailed' 'time' 'reason' (Without quotes). 
      }
    }
    else { 
      msg # The jailing overview system is not enabled. 
    }
  }
  elseif ( $1 == .unjail ) {
    if ($nick !isop #) {
      msg # ( $+ $nick $+ ) $+ , You do not have the authority to do this
      goto end
    }
    if ($readini(jail.ini,conf,stat)) {
      if (!$readini(jailuser.ini, Jail, $2)) {
        msg # The requested user ( $+ $2 $+ ) is not Jailed.
      }
      elseif ($readini(jailuser.ini, Jail, $2)) {
        remini jailuser.ini jail $2-
        ;remini jailuser.ini jail $3
        ;remini jailuser.ini jail %user $+ timer
        msg # The requested user ( $+ $2 $+ ) was unjailed.
      }
      else msg # Insufficient Parameters: .unjail 'The user that shall be unjailed' (Without quotes).
    }
    else msg # The jailing overview system is not enabled.
  }
  elseif ($nick !isop $chan) {
    msg # ( $+ $nick $+ ), You do not have authority to do that action.
  }
  elseif ( $1 == .jailedusers ) {
    if ($nick !isop #) {
      msg # ( $+ $nick $+ ), You do not have the authority to do this
      goto end
    }
    if ($nick isop #) { msg # There Are A Total Of ( $+ $ini(jailuser.ini, jail, 0) $+ ) Users in the Jailing system }
  }
  elseif ( $1 == .jailednicks ) {
    if ($nick !isop $chan) {
      msg # ( $+ $nick $+ ), You do not have authority to do that action.
      goto end
    }
    var %j = $ini(jailuser.ini, jail, 0)
    var %c = 1, %a = 1 $4-
    msg # The Jailed User(s) Are:
    while (%c <= %j) {
      var %user =  $ini(jailuser.ini, jail, %c)
      var %time_left = Unspecified
      if ($timer( $+(%user,unjailmsg) ) != $null) { var %time_left = $duration( $timer($+(%user,unjailmsg)).secs ) }
      msg # $+($chr(35),%c,:) %user - %time_left - By: $gettok($readini(jailuser.ini ,jail, %user),1,32) $+ , Reason: $iif($gettok($readini(jailuser.ini, jail, %user),2-,32),$gettok($readini(jailuser.ini, jail, %user),2-,32),-NONE-)       
      inc %c
      inc %a
    }
    msg # End Of List
  }
  elseif ($1 == .clear) {
    if ($nick !isop $chan) {
      msg # ( $+ $nick $+ ), You do not have authority to do that action.
      goto end
    }
    msg # There were a total of $ini(jailuser.ini, jail, 0) users in the jailing system.
    .remove jailuser.ini
    msg # The jailing system was cleared.
  }
  :end
}

Comments

Sign in to comment.
Anthrophobic   -  Apr 29, 2009

I give you credit for the script, but what exactly does it do? You jail a user and he is still in channel and can still talk. Atleast make it devoice the user.

 Respond  
LO_KEY   -  Jan 26, 2007

@ no_body21

var %time_left = Unspecified
if ($timer( $+(%user,unjailmsg) ) != $null) { var %time_left = $duration( $timer($+(%user,unjailmsg)).secs ) }

Unspecified then vars again?

could use only
%time_left = $duration( $timer($+(%user,unjailmsg)).secs

reason we setting the var twice, is if when the user is jailed, the jailer doesnt put a time to unjail, then it will remain Unspecified, if they did then itll replace Unspecifed with the time left for the jailed. :p

Look at the code. :D

 Respond  
Lindrian   -  Jan 26, 2007

thanks once again.

 Respond  
no_body21   -  Jan 26, 2007

thats what youre asking for lindrian

 Respond  
Lindrian   -  Jan 26, 2007

Yeah, I catch you with that. You, or someone, will need to give me some back-stage secret lessions about hashtables tho ;c

 Respond  
DarthReven   -  Jan 26, 2007

nothing wrong with using two files it just makes data easier to reference and makes the code neater

 Respond  
Lindrian   -  Jan 26, 2007

Yeah, thats true. but I guess, using 2 ini files wont hurt? Or might that give the script extra processing that\'ll lag it up? If so, next time I wont repeat it. And ill try hashtables aswell.

 Respond  
DarthReven   -  Jan 26, 2007

rather then using 2 ini files why not use one with different sections like JAIL and SETTINGS then under each you can keep the aproprate data.

 Respond  
Lindrian   -  Jan 25, 2007

I didnt know if people would like it in secs or minutes, so i just made a \"guide\". and thanks for the usfull information No_body21.

 Respond  
no_body21   -  Jan 25, 2007

Edit: Added the function to jail someone in minutes instead, since that was a bit mroe usfull for me.
So, incase you want to use minutes instead of seconds, change line (32) from (var %timer = $3) to (var %timer = $3 * 60) and line (34) from \'(\' ( $+ $duration($3) $+ ). \')\' to \'(\' ( $+ $duration(%timer,$3) $+ ). \')\'


You could just edit the snippet of yours...

 Respond  
no_body21   -  Jan 25, 2007

elseif ($nick !isop $chan) { msg # You do not have authority to do that action. }

else ($nick !isop $chan) { msg # You do not have authority to do that action. }

and

var %time_left = Unspecified
if ($timer( $+(%user,unjailmsg) ) != $null) { var %time_left = $duration( $timer($+(%user,unjailmsg)).secs ) }

Unspecified then vars again?

could use only
%time_left = $duration( $timer($+(%user,unjailmsg)).secs


5/10

 Respond  
Lindrian   -  Jan 25, 2007

I never workded with hashtables, So I dont know the difference at all. If they\'re better or not :p. But ill try the /help file a lonely day or something. But overall, whatcha think of the snippet :P?

 Respond  
no_body21   -  Jan 25, 2007

try using hash

 Respond  
Lindrian   -  Jan 25, 2007

Haha, thanks ^.^

 Respond  
F*U*R*B*Y*   -  Jan 25, 2007

^_^ a comment :P

 Respond  
Lindrian   -  Jan 25, 2007

I hope it was usfull for someone more then me! Atleast something on the code? A comment? bad or good? ;x

 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.