mIRC Home    About    Download    Register    News    Help

Print Thread
$hget and $exists #175910 30/04/07 02:03 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
I want to get and save in another folder call sys dir not in the main dir.

Code:
 
on *:start:{  
if !$hget(NB) { .hmake NB 100 }  
if $exists(NB.hsh) { .hload NB NB.hsh }
}
on *:exit:{
.hsave -o NB NB.hsh
}
on *:disconnect:{  
.hsave -o NB NB.hsh
}

menu nicklist {
-
Notify Ban Settings
.Add Nick: banlist add $$?="Nick To Add"
.Add $1: banlist add $iif(!$snicks,$$?="Nick(s) To Add",$snicks)
.-
.Remove Nick: banlist del $$?="Nick To Remove"
.Remove $1: banlist del $iif(!$snicks,$$?="Nick To Remove",$snicks)
.-
.View BanList: .hsave -o NB NB.hsh | run NB.hsh
.-
.Clear BanList: .hfree NB | $iif($exists(NB.hsh),remove NB.hsh)
}
alias banlist {
var %nicks = $remove($replace($2-,$chr(32),$chr(44)),$me)  
while %nicks {
notify $iif($1 == del,-r) $gettok(%nicks,1,44)    
.hadd -m NB $gettok(%nicks,1,44) $iif($1 == add,Banned)
%nicks = $remtok(%nicks,$gettok(%nicks,1,44),1,44)
  }
}
on *:notify: {
if ( %bnn == off ) || ( %bnn == $null ) || ($nick isop #) { return }  
if $hget(NB,$nick) {
var %a = 1, %b = $chan(0)    
while %a <= %b {
if ($me isop $chan(%a)) {        
ban $chan(%a) $nick 2
      }      
inc %a    
   }  
 }
}

Re: $hget and $exists [Re: Garou] #175911 30/04/07 02:13 PM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,010
First, in the START event, create the directory if it doesn't already exist...

if (!$isdir($mircdirsys)) mkdir $qt($mircdirsys)

Then when loading or saving NB.hsh use...

$qt($mircdirsys\NB.hsh)

Re: $hget and $exists [Re: RoCk] #175915 30/04/07 02:26 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
Not working it still gets and save in the main dir.

Re: $hget and $isfile [Re: Garou] #175916 30/04/07 02:33 PM
Joined: Dec 2002
Posts: 2,010
R
RoCk Offline
Hoopy frood
Offline
Hoopy frood
R
Joined: Dec 2002
Posts: 2,010
Create an identifier to return the path\file of your hash file...

alias nb.hsh return $qt($mircdirsys\NB.hsh)

Code:
alias nb.hsh return $qt($mircdirsys\NB.hsh)

on *:start:{
  if (!$isdir($mircdirsys)) mkdir $qt($mircdirsys)
  if !$hget(NB) { .hmake NB 100 }  
  if $isfile($nb.hsh) { .hload NB $nb.hsh }
}

on *:exit:{
  .hsave -o NB $nb.hsh
}

on *:disconnect:{  
  .hsave -o NB $nb.hsh
}

menu nicklist {
  -
  Notify Ban Settings
  .Add Nick: banlist add $$?="Nick To Add"
  .Add $1: banlist add $iif(!$snicks,$$?="Nick(s) To Add",$snicks)
  .-
  .Remove Nick: banlist del $$?="Nick To Remove"
  .Remove $1: banlist del $iif(!$snicks,$$?="Nick To Remove",$snicks)
  .-
  .View BanList: .hsave -o NB $nb.hsh | run $nb.hsh
  .-
  .Clear BanList: .hfree NB | $iif($isfile($nb.hsh),remove $nb.hsh)
}

alias banlist {
  var %nicks = $remove($replace($2-,$chr(32),$chr(44)),$me)  
  while %nicks {
    notify $iif($1 == del,-r) $gettok(%nicks,1,44)    
    .hadd -m NB $gettok(%nicks,1,44) $iif($1 == add,Banned)
    %nicks = $remtok(%nicks,$gettok(%nicks,1,44),1,44)
  }
}

on *:notify: {
  if ( %bnn == off ) || ( %bnn == $null ) || ($nick isop #) { return }  
  if $hget(NB,$nick) {
    var %a = 1, %b = $chan(0)    
    while %a <= %b {
      if ($me isop $chan(%a)) {        
        ban $chan(%a) $nick 2
      }      
      inc %a    
    }  
  }
}


...then restart mIRC.

Re: $hget and $exists [Re: RoCk] #175917 30/04/07 02:40 PM
Joined: Aug 2006
Posts: 469
G
Garou Offline OP
Fjord artisan
OP Offline
Fjord artisan
G
Joined: Aug 2006
Posts: 469
THX guys.