All pastes #616121 Raw Edit

Stuff

public text v1 · immutable
·published 2007-07-12 13:48 UTC
rendered paste body
on *:load:{
  set %inactividadecanais #
  set %tempoinactividade 1200
  set %inactividadestatus Desligado

}




on *:Join:#:{
  if ($chan $+ , isin %inactividadecanais $+ ,) {
    /timer 1 3 set %removechan $chan
    /timer 1 3 removeop
    /timer 1 3 removevoice
  }
}

on *:op:#:{
  if (!$read(excepcoesinactividade.txt,$opnick)) && (%inactividadestatus == Ligado) && ($chan $+ , isin %inactividadecanais $+ ,) { {
      if ($opnick != $me) {
        /timerremoveop $+ $opnick $+ $chan 1 %tempoinactividade chanserv deop $chan $opnick
        /timerremoveop2 $+ $opnick $+ $chan 1 %tempoinactividade set [ % $+ [ removeop $+ [ $opnick $+ [ $chan ] ] ] ] 1
      }
    }
  }

  on *:voice:#:{
    if (!$read(excepcoesinactividade.txt,$vnick)) && (%inactividadestatus == Ligado) && ($chan $+ , isin %inactividadecanais $+ ,) {
      if ($opnick != $me) {
        /timerremovevoice $+ $vnick $+ $chan 1 %tempoinactividade chanserv deop $chan $vnick
        /timerremovevoice2 $+ $vnick $+ $chan 1 %tempoinactividade set [ % $+ [ removeop $+ [ $vnick $+ [ $chan ] ] ] ] 1
      }
    }
  }

  on *:deop:#:{
    if ($opnick != $me) {
      /timerremove $+ $opnick $+ $chan off
      /timerremove2 $+ $opnick $+ $chan off
    }
  }

  on *:devoice:#:{
    if ($vnick != $me) {
      /timerremove $+ $vnick $+ $chan off
      /timerremove2 $+ $vnick $+ $chan off
    }
  }


  on *:PART:#:{
    /timerremoveop $+ $nick $+ $chan off
    /timerremoveop2 $+ $nick $+ $chan off
    /timerremovevoice $+ $nick $+ $chan off
    /timerremovevoice2 $+ $nick $+ $chan off
  }

  on *:quit:{
    /timerremoveop $+ $nick $+ $chan off
    /timerremoveop2 $+ $nick $+ $chan off
    /timerremovevoice $+ $nick $+ $chan off
    /timerremovevoice2 $+ $nick $+ $chan off
  }
  ON *:TEXT:*:#:{

    if (!$read(excepcoesinactividade.txt,$nick)) && (%inactividadestatus == Ligado) && ($chan $+ , isin %inactividadecanais $+ ,) {
      if (($nick isop $chan)) {
        /timerremoveop [ $+ [ $nick ] ] $chan  1 %tempoinactividade chanserv deop $chan $nick
        /timerremoveop2 [ $+ [ $nick ] ] $chan 1 %tempoinactividade set [ % $+ [ removeop $+ [ $nick $+ [ $chan ] ] ] ] 1
      }  


      if (($nick isvoice $chan)) {
        /timerremovevoice [ $+ [ $nick ] ] $chan  1 %tempoinactividade chanserv deop $chan $nick
        /timerremovevoice [ $+ [ $nick ] ] $chan 1 %tempoinactividade set [ % $+ [ removeop $+ [ $nick $+ [ $chan ] ] ] ] 1
      }


      if ([ % $+ [ removeop $+ [ $nick $+ [ $chan ] ] ] ]) {
        chanserv op $chan $nick
        unset [ % $+ [ removeop $+ [ $nick $+ [ $chan ] ] ] ]
      }

      if ([ % $+ [ removeop $+ [ $nick $+ [ $chan ] ] ] ]) {
        chanserv voice $chan $nick
        unset [ % $+ [ removeop $+ [ $nick $+ [ $chan ] ] ] ]
      }
    }
  }



  alias removeop  {   
    var %contadorop = 1
    While ($nick(%removechan,0,o) >= %contadorop) {
      if (!$read(excepcoesinactividade.txt,$nick(%removechan,%contadorop,o))) && (%inactividadestatus == Ligado) {
        if ($me != $nick(%removechan,%contadorop,o)) {
          /timerremoveop $+ $nick(%removechan,%contadorop,o) $+ %removechan 1 %tempoinactividade chanserv deop %removechan $nick(%removechan,%contadorop,o)
          /timerremoveop2 $+ $nick(%removechan,%contadorop,o) $+ %removechan 1 %tempoinactividade set [ % $+ [ removeop $+ [ $nick(%removechan,%contadorop,o) $+ [ %removechan ] ] ] ] 1
        }
      }
      inc %contadorop
    }
  }
  alias removevoice  {   
    var %contadorop = 1
    While ($nick(%removechan,0,v) >= %contadorop) {
      if (!$read(excepcoesinactividade.txt,$nick(%removechan,%contadorop,v))) && (%inactividadestatus == Ligado) {
        if ($me != $nick(%removechan,%contadorop,v)) {
          /timerremovevoice $+ $nick(%removechan,%contadorop,v) $+ %removechan 1 %tempoinactividade chanserv deop %removechan $nick(%removechan,%contadorop,v)
          /timerremovevoice2 $+ $nick(%removechan,%contadorop,v) $+ %removechan 1 %tempoinactividade set [ % $+ [ removevoice $+ [ $nick(%removechan,%contadorop,v) $+ [ %removechan ] ] ] ] 1
        }
      }
      inc %contadorop
    }
  }





  menu channel,menubar {
    -
    Inactividade script
    .Estado $+ $chr(58) $chr(9) %inactividadestatus :halt
    .-
    .$iif(%inactividadestatus = Ligado,$style(2) Ligar,Ligar):set %inactividadestatus Ligado
    .$iif(%inactividadestatus = Desligado,$style(2) Desligar,Desligar):set %inactividadestatus Desligado
    .-
    .Canal/canais %inactividadecanais :halt
    .Definir Canal/Canais: set %inactividadecanais $$?="Digite o canal ou canais. Os canais devem ser separados por uma vírgula! ex:#canal1,#canal2,#canal3..."
    .-
    .Tempo de inactividade permitida %tempoinactividade $+ s :set %tempoinactividade $$?="coloque o tempo de inactividade em segundos!"
  }

  menu channel,nicklist {
    -
    .$iif($read(excepcoesinactividade.txt,$$1),Retirar excepção de inactividade,Adicionar ás excepções de inactividade):if($read(excepcoesinactividade.txt,$$1)) { /write -dl $+ $readn excepcoesinactividade.txt } else {/write excepcoesinactividade.txt $$1}

  }