mIRC Home    About    Download    Register    News    Help

Print Thread
#169596 25/01/07 09:59 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
I got this code of a site and every thing works but when some one joins the chan and the chan they r in is a vip chan it dont do any thing like op or voice and i can not contact foreek so i was wondering if any one could look at this and help me out?

Code:
;-----------------------------------------------
; ViP Bot script made by Foreek
; Visit #Foreek @ QuakeNet
; Don't edit anything below this line!
; Unless you really know what you are doing!
;-----------------------------------------------
on Master:TEXT:!vip*:#: {
  if ($2 == on) {
    if (!% [ $+ [ $chan ] $+ ] .vip.status) {
      set % [ $+ [ $chan ] $+ ] .vip.status on
      set % [ $+ [ $chan ] $+ ] .vip.mode +
      notice $nick .:: $+ $chan $+ ::. Vip enabled
    }
    else { notice $nick .:: $+ $chan $+ ::. Vip is already on! }
  }
  elseif ($2 == off) {
    if (% [ $+ [ $chan ] $+ ] .vip.status == on) {
      unset % [ $+ [ $chan ] $+ ] .vip.status
      notice $nick .:: $+ $chan $+ ::. Vip disabled
    }
    else { notice $nick .:: $+ $chan $+ ::. Vip is already off! }
  }
  elseif ($2 == status) {
    notice $nick .:: $+ $chan $+ ::. Vip is $iif(% [ $+ [ $chan ] $+ ] .vip.status == on,on,off)
  }
  elseif ($2 == add) {
    if (!$3) { notice $nick .:: $+ $chan $+ ::. Usage: !vip add #chan @/+ }
    if (% [ $+ [ $chan ] $+ ] .vip.status == on) {
      if (($3 != $chan) && ($left($3,1) == $chr(35))) {
        % [ $+ [ $chan ] $+ ] .vip.chans = $addtok(% [ $+ [ $chan ] $+ ] .vip.chans, [ $+ [ $3 ] $+ ] ,32)
        notice $nick .:: $+ $chan $+ ::. Chan $3 added successfully to ViP-chans.
      }
      elseif ($3 == $chan) {
        notice $nick .:: $+ $chan $+ ::. You can't add this chan to ViP-chans.
      }
      elseif ($left($3,1) != $chr(35)) {
        notice $nick .:: $+ $chan $+ ::. Invalid channel!
      }
    }
    else { notice $nick .:: $+ $chan $+ ::. Vip is off! }
  }
  elseif ($2 == del) {
    if (!$3) { notice $nick .:: $+ $chan $+ ::. Usage: !vip del #chan }
    if (% [ $+ [ $chan ] $+ ] .vip.status == on) {
      if ($3 isin % [ $+ [ $chan ] $+ ] .vip.chans) {
        % [ $+ [ $chan ] $+ ] .vip.chans = $remtok(% [ $+ [ $chan ] $+ ] .vip.chans, [ $+ [ $3 ] $+ ] ,1,32)
        notice $nick .:: $+ $chan $+ ::. Chan $3 Deleted successfully.
      }
      else { notice $nick .:: $+ $chan $+ ::. I can't find this channel! }
    }
    else { notice $nick .:: $+ $chan $+ ::. Vip is off! }
  }
  elseif ($2 == mode) {
    if (!$3) { notice $nick .:: $+ $chan $+ ::. Usage: !vip mode @/+ }
    if (% [ $+ [ $chan ] $+ ] .vip.status == on) {
      if ($3 == $chr(64)) || ($3 == $chr(43)) {
        set % [ $+ [ $chan ] $+ ] .vip.mode $3
        notice $nick .:: $+ $chan $+ ::. Vip mode set to $3
      }
      else { notice $nick .:: $+ $chan $+ ::. Invalid mode! Available modes are @ or + }
    }
    else { notice $nick .:: $+ $chan $+ ::. Vip is off! }
  }
  elseif ($2 == help) {
    timervip1 1 0 notice $nick .:: $+ $chan $+ ::. Commands are:
    timervip2 1 1 notice $nick .:: $+ $chan $+ ::. !vip on/off
    timervip3 1 2 notice $nick .:: $+ $chan $+ ::. !vip status
    timervip4 1 3 notice $nick .:: $+ $chan $+ ::. !vip add/del/list
    timervip5 1 4 notice $nick .:: $+ $chan $+ ::. !vip mode
    timervip6 1 5 notice $nick .:: $+ $chan $+ ::. !vip skin
  }
  elseif ($2 == list) {
    if (% [ $+ [ $chan ] $+ ] .vip.status == on) {
      if (% [ $+ [ $chan ] $+ ] .vip.chans) {
        notice $nick .:: $+ $chan $+ ::. Added channels: % [ $+ [ $chan ] $+ ] .vip.chans
      }
      else { notice $nick .:: $+ $chan $+ ::. I can't find any channel! }
    }
    else { notice $nick .:: $+ $chan $+ ::. Vip is off! }
  }
  elseif ($2 == skin) {
    if (!$3) { notice $nick .:: $+ $chan $+ ::. Create your own skin! :nick: - Vip nick :: :host: - Vip host :: :id: - Vip ID :: :chan: - Vip coming from :: :mode: - Mode received. }
    if ($3) {
      set % [ $+ [ $chan ] $+ ] .vip.skin $3-
      notice $nick .:: $+ $chan $+ ::. Skin created! example:
      timerskin1 1 1 notice $nick .:: $+ $chan $+ ::. $replace(% [ $+ [ $chan ] $+ ] .vip.skin,:host:,$address($nick,2),:chan:,$chan,:nick:,$nick,:id:,1,:mode:,@)
    }
  }
  elseif (!$2) {
    notice $nick .:: $+ $chan $+ ::. Need help? Type !vip help
  }
}
on *:JOIN:#: {
  if (% [ $+ [ $chan ] $+ ] .vip.status == on) {
    if (!% [ $+ [ $chan ] $+ ] .vip.id) { set % [ $+ [ $chan ] $+ ] .vip.id 0 }
    inc % [ $+ [ $chan ] $+ ] .vip.id
    set %vip.nick $nick
    set %vip.chan $chan
    set %vip.host $address($nick,2)
    whois $nick
  }
}
raw 319:*: {
  var %i 0
  var %z $3-
  var %c $numtok(% [ $+ [ %vip.chan ] $+ ] .vip.chans,32)
  var %u $remove($3-,$chr(64),$chr(43))
  :loop
  var %i
  var %lookup $findtok(%u, [ $+ [ $gettok(% [ $+ [ %vip.chan ] $+ ] .vip.chans, [ $+ [ %i ] $+ ] ,32) ] $+ ] ,1,32)
  if (%i > %c) { goto vip }
  tokenize 32 %z
  if ($left($ [ $+ [ %lookup ] $+ ] ,1) == $chr(64)) { var %vip.from $addtok(%vip.from, [ $+ [ $gettok(%u, [ $+ [ %lookup ] $+ ] , 32) ] $+ ] ,32) | goto loop }
  elseif (%i <= %c) { goto loop }
  :vip
  if (%vip.from) {
    msg %vip.chan $replace(% [ $+ [ %vip.chan ] $+ ] .vip.skin,:host:,%vip.host,:nick:,%vip.nick,:chan:,%vip.from,:id:,% [ $+ [ %vip.chan ] $+ ] .vip.id,:mode:,% [ $+ [ %vip.chan ] $+ ] .vip.mode)
    mode %vip.chan + $+ $iif(% [ $+ [ %vip.chan ] $+ ] .vip.mode == @,o,v) %vip.nick
  }
}


THX.

Last edited by BuTLeR; 25/01/07 11:14 PM.

At Your Service.
BuTLeR #169613 26/01/07 04:02 AM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
Well the easiest answer I can come up with is that the code is screaming to be buggy. That being the case Im not too interested in trying to make it work. Suffice it to say, they have an if statement following an elseif statement.



elseif (%i <= %c) { goto loop }
:vip
if (%vip.from) {


Change the elseif to an if and see if that helps.



DJ_Sol #169614 26/01/07 04:21 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
There isn't anything wrong with IF after ELSEIF. The IF is just not part of the IF/ELSEIF section that preceded it.


Invision Support
#Invision on irc.irchighway.net
BuTLeR #169615 26/01/07 04:24 AM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
First of all, I'd echo this:

//echo -a % [ $+ [ $chan ] $+ ] .vip.status

Type this IN THE CHANNEL you can't get to work. It should echo "on". If it doesn't, then that's your problem.. you don't have it turned on.

As as note, the [] evaluation method used isn't a good method, but I'm not going to rewrite the entire thing. smile


Invision Support
#Invision on irc.irchighway.net
Riamus2 #169621 26/01/07 08:21 AM
Joined: Jan 2007
Posts: 1,156
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
I've never had success mixing up if's and elseif's. It's how I was taught: if, elseif, else. I have had code not work when mixing it up. Maybe its silly superstition. I'd like to know if I am incorrect.

DJ_Sol #169630 26/01/07 02:14 PM
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Take this example:

Code:
if (%test == 1) { echo 1 }
elseif (%test == 2) { echo 2 }
if (%game == on) { echo on }
else { echo off }
if (%play > 5) { echo high }
elseif (%play == 5) { echo -a mid }
else { echo -a %low }


That is 3 independent sets of IF/ELSEIF/ELSE statements. They don't affect each other. Perhaps with the first one, the user didn't care about doing anything if %test wasn't 1 or 2, so it used ELSEIF, but didn't include ELSE. It won't hurt anything to leave ELSE off. You just need to make sure not to mix up the independent sets... you can't start a set with ELSEIF or ELSE. As long as the set starts with IF, then it won't be part of the previous set.


Invision Support
#Invision on irc.irchighway.net
Riamus2 #169662 26/01/07 05:29 PM
Joined: Oct 2006
Posts: 68
B
BuTLeR Offline OP
Babel fish
OP Offline
Babel fish
B
Joined: Oct 2006
Posts: 68
well thx but i have no idea how to sort it still lolz smile


At Your Service.

Link Copied to Clipboard