mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I am trying to make it to where if the $nick is trying to time out their self, it will come back with a message saying, you can't timeout yourself, or if they are trying to ban themselves, it says you can't ban yourself. Here is what I have so far.

Code:
on *:TEXT:!kick * *:#: {
  if ($nick isop #) {
    var %nick = $$2
    var %interval = $$3
    msg $chan /timeout %nick %interval 
    msg $chan /me $capital(%nick) was timed out from the chat for %interval second(s). Please consider following rules next time. $capital(%nick) $+ ! 
}
else { msg $chan You aren't a moderator. DansGame } 
}
elseif ($nick == %nick) { msg # You can't time out yourself! Kappa }
  
}


on *:TEXT:!kick *:#: {
  if ($nick isop #) {
    var %nick = $$2
    msg $chan /timeout %nick  
    msg $chan /me $capital(%nick) was timed out from the chat for 10 minutes. Please consider following rules next time. $capital(%nick) $+ !
} 
 else { msg $chan You aren't a moderator. DansGame } 
}
elseif ($nick == %nick) { msg # You can't time out yourself! Kappa }
}

 
}



on *:TEXT:!ban *:#: {
  if ($nick isop #) {
    var %nick = $$2
    msg $chan /ban %nick 
    msg $chan /me Get rekt $capital(%nick) $+ ! If we are up to this point, it is obvious you don't want to follow the rules!
}
elseif ($nick == %nick) { msg # You can't ban yourself! Kappa }
  }
  else { msg $chan Woah do you have special powers? I don't think you are a mod. Kappa }

}

on *:TEXT:!unban *:#: {
  if ($nick isop #) {
    var %nick = $$2
    msg $chan /unban %nick 
    msg $chan /me $capital(%nick) has been unbanned from the chat. You have been given a second chance, don't screw it up $capital(%nick) $+ ! SwiftRage
}
elseif ($nick == %nick) { msg # You can't ban yourself! Kappa }
  }
  else { msg $chan Who do you think you are, a moderator? Keepo }

}

alias capital return $upper($left($1,1)) $+ $mid($1,2-)

Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
Try and insert this line

Code:
if ($nick == $$2) { msg # You can't kick yourself! | return }

Joined: May 2015
Posts: 249
Fjord artisan
Offline
Fjord artisan
Joined: May 2015
Posts: 249
You just make if-else in wrong sequence, your first IF works and last elseif (which checks for $nick == %nick) wont. Assign variables out of if-else and replace your conditions a little bit.


Dont give a fish - teach to fish!
Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Thanks Sakana I knew it had something to do with the identifiers. So I have a question why can't it identify %nick just out of curiosity?

Last edited by powerade661; 29/05/15 07:43 AM.
Joined: Sep 2014
Posts: 259
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Sep 2014
Posts: 259
They're interchangeable -- you can use either one, as long as you declare %nick before using it in a statement

Code:
var %nick = $$2
if ($nick == %nick) { msg # You can't kick yourself! | return }

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
Oh ok that makes sense, thanks man.

Joined: Jan 2015
Posts: 168
P
Vogon poet
OP Offline
Vogon poet
P
Joined: Jan 2015
Posts: 168
I have another question. I have this script by Majeye and I was wondering if this is possible. Basically if you do !uptime it grabs the uptime from nightdev. Is it possible to search for the uptime, but only post in the chat if the stream goes online or offline and when the stream goes offline to display how long the uptime was?

Code:
on *:text:!uptime*:#:{
  if ((%flooduptime) || ($($+(%,flooduptime.,$nick),2))) { return }
  set -u5 %flooduptime On
  set -u10 %flooduptime. $+ $nick On
  set %target $iif($2,$2,$mid(#,2-))
  set %channel #
  uptime
}
 
alias uptime {
  sockclose uptime
  sockopen uptime nightdev.com 80
}
 
on *:sockopen:uptime:{
  if ($sockerr) { sockclose $sockname | halt }
  sockwrite -n $sockname GET /hosted/uptime.php?channel= $+ %target HTTP/1.1
  sockwrite -n $sockname Host: www.nightdev.com
  sockwrite -n $sockname $crlf
}
 
on *:sockread:uptime:{
  if ($sockerr) { sockclose $sockname | halt }
  var %data
  sockread %data
  tokenize 32 %data
  if ($1 isnum) && ($2) { msg %channel %target has been online for $1- }
  elseif (%data == The channel is not live.) msg %channel %target is currently not online/streaming.
 
}
 
on *:sockclose:uptime:{
  unset %channel
  unset %target
}


Link Copied to Clipboard