Channel Script

By HLBNigel on Feb 09, 2006

My Channel Commands Are !register Password !login Password !Op NickName !Deop NickName !Voice NickName !devoice Nickname !ban NickName !unban NickName !kick NickName !curse NickName

;Channel Script
;-
;-
;Script starts here
on *:JOIN:#CHATROOM {
  set %joindata $readini(users.ini, $nick $+ , username)
  if (%joindata == $null) {
    msg $chan Hey, Welcome To #CHATROOM, $nick $+ !
  }
  else {
    msg $chan Welcome Back , $nick $+ !
  }
  unset %joindata
}
on *:TEXT:*:? {
  if ($1 == !register) {
    set %joindata $readini(users.ini, $nick $+ , username)
    if (%joindata == $null) {
      msg $nick You are registered with the nickname $nick and the password $2
      writeini -l users.ini $nick username $nick
      writeini -l users.ini $nick password $2
      writeini -l users.ini $nick mode +o
      writeini -l users.ini $nick admin 0
      msg $nick You need to login using !login password
      topic #CHATROOM 9,1Welcome to #CHATROOM 4-9,1 The place to be chatting! 4-9,1 Newest member: $nick $+ !! Welcome to #CHATROOM, $nick $+ !
    }
    else {
      msg $nick There is already a user under your name!
    }
    halt
  }

  if ($1 == !login) {
    set %joindata $readini(users.ini, $nick $+ , username)
    if (%joindata == $null) {
      msg $nick Sorry, you are not registered!
    }
    else {
      if ($2 == $readini(users.ini, $nick $+ , password)) {
        msg $nick Thanks, $nick $+ , You are now logged in!<SafeServ> You need to be registered to be able to chat! 
        mode $chan +o $nick
        mode #Chatroom +o $+ $readini(users.ini, $nick $+o , mode) $nick
        msg $nick The mode $readini(users.ini, $nick $+o , mode) has been set on you in #CHATROOM!
      }
      else {
        msg $nick Invalid password!
      }
    }
    halt
  }
  ;READ THIS!
  ;################################
  ;################################
  ;Add this "if" inside the "on" command but outside of the commands you want to be executed only by users:
  };SafeServ By Actaviosan
  ;==========================

  on *:load: {
    echo -a 4SafeServ 4I7s 4S7uccesfully 4L7oaded1.
    echo -a 12T2his 12B2ot 12W2as 12C2reated 12B2y 12S2afeServ1.
  }
  on *:join:#CHATROOM: {
    notice $nick Welcome to our channel,
  }
  on *:text:!op *:#CHATROOM: {
    if ($nick isop #CHATROOM) { mode #CHATROOM +o $2 }
    else notice $nick You're not a general and I cannot do your commands.  
  }
  on *:text:!deop *:#CHATROOM: {
    if ($nick isop #CHATROOM) ( mode #CHATROOM -o $2 )
    else notice $nick You're not a general and I cannot do your commands.
  }
  on *:text:!voice *:#CHATROOM: {
    if ($nick isop #CHATROOM) { mode #CHATROOM +v $2 )
      else notice $nick You're not a general and I cannot do your commands.
    }
    on *:text:!devoice *:#CHATROOM: {
      if ($nick isop #CHATROOM) ( mode #CHATROOM -v $2 )
      else notice $nick You're not a general and I cannot do your commands.
    }
    on *:text:!ban *:#CHATROOM: {
      if ($nick isop #CHATROOM) { mode #CHATROOM +b $2 )
        else notice $nick You're not a general and I cannot do your commands.
      }
      on *:text:!unban *:#CHATROOM: {
        if ($nick isop #CHATROOM) { mode #CHATROOM -b $2 )
          else notice $nick You're not a general and I cannot do your commands.
        }
        on *:text:!kick *:#CHATROOM: (
        if ($nick isop #CHATROOM) ( kick #CHATROOM $2 )
        else notice $nick You're not a general and I cannot do your commands.
      }
      on *:text:!curse *:#CHATROOM: {
        if ($nick isop #CHATROOM) ( msg #CHATROOM $2 When Some1 Says Leave Them Alone They Mean Leave Them Alone )
        else notice $nick You're not a general and I cannot do your commands.
      }

      My Channel Commands Are !register Password !login Password !Op NickName !Deop NickName !Voice NickName !devoice Nickname !ban NickName !unban NickName !kick NickName !curse NickName

Comments

Sign in to comment.
QuickStep   -  Feb 09, 2006

xdaemon is right a common mistake I tend to make also, %a = $null, a has no value (!%a) %a has no value or is 0

 Respond  
xDaeMoN   -  Feb 09, 2006

@ bear, \'!%a\' means \'0\' or $null.

 Respond  
bearruler   -  Feb 09, 2006

Please test your snippets before submitting them, there is obviously a bracket align issue with this one
There is also:
on :TEXT::? { Which Im fairly sure you need the : after the ?

Also, ini files are slow, hash tables might have been better for this
A few pointers
if (%a == $null) is the same as if (!%a)
With one lines commands after ifs, you dont need { }
You should also set up a menu or dialog to let them add channels so tey dont have to change #CHANNEL in 50 places
Inside script events you can also use $chan

Its a good script but it looks like it could use abit most testing...

Bear

 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.