mIRC Home    About    Download    Register    News    Help

Print Thread
#168099 03/01/07 07:16 PM
Joined: Apr 2006
Posts: 400
K
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
Ok guys, I have this script that I'm making where it deops someone after a certain amount of time, I don't know how to mess with hash tables very good, the hash tables stay set, but, when I restart IRC, they reset, here's what I have:
Code:
    if ($did == 1) {
      if ($hget(Game/Help)) { hfree Game/Help }
      hadd -m Game/Help $left($did($adp,1),1)
    }
    if ($did == 4) {
      if ($hget(Opers)) { hfree Opers }
      hadd -m Opers $left($did($adp,4),2)
    }



Here is my full code if needed:
Code:
dialog ADeop-Panel {
  title "Auto Deop Panel"
  size -1 -1 122 74
  option dbu
  combo 1, 5 16 53 45, size drop
  box "XBC Help/Game Deop", 2, 2 8 59 55
  box "XBC Opers Deop", 3, 61 8 59 55
  combo 4, 64 16 52 45, size drop
  button "OK", 5, 44 64 35 9, ok
  text "Deop After?", 6, -1 0 123 8, center
}
alias Deop-Panel { dialog -mdro Adeop-panel adeop-panel }
on *:INPUT:#: {
  if (*/* !iswm $left($1,1)) {
    if ($chan == #xbca_opers) {
      if ($timer(idle)) { timeridle off }
      timeridle 0 2 idle-check-opers
    }
    if ($chan == #xbca_help) {
      if ($timer(idle1)) { timeridle1 off }
      timeridle1 0 2 idle-check-hg
    }
  }
}
alias idle-check-hg {
  if (*mins* iswm $duration($nick(#xbc_help,$me).idle)) { 
    if (!$hget(Game/Help)) {
      if ($left($duration($nick(#xbc_help,$me).idle),2) >= 5) {
        if ($me isop #xbc_help) { cs deop #xbc_help .timeridle1 off }
        if ($me ishop #xbc_help) { cs dehalfop #xbc_help .timeridle1 off }
        if ($me isop #xbc_game) { cs deop #xbc_game .timeridle1 off }
        if ($me ishop #xbc_game) { cs dehalfop #xbc_game .timeridle1 off }
      }
    }
    if ($hget(Game/Help)) {
      if ($left($duration($nick(#xbc_help,$me).idle),2) >= $hget(Game/Help,1).item) {
        if ($me isop #xbc_help) { cs deop #xbc_help .timeridle1 off }
        if ($me ishop #xbc_help) { cs dehalfop #xbc_help .timeridle1 off }
        if ($me isop #xbc_game) { cs deop #xbc_game .timeridle1 off }
        if ($me ishop #xbc_game) { cs dehalfop #xbc_game .timeridle1 off }
      }
    }
  }
}
alias idle-check-opers {
  if (*mins* iswm $duration($nick(#xbc_opers,$me).idle)) { 
    if (!$hget(Opers)) {
      if ($left($duration($nick(#xbc_opers,$me).idle),2) >= 8) { 
        if ($me isop #xbc_opers) { cs deop #xbc_opers | .timeridle off }
        if ($me ishop #xbc_opers) { cs dehalfop #xbc_opers | .timeridle off }
      }
    }
    if ($hget(Opers)) {
      if ($left($duration($nick(#xbc_opers,$me).idle),2) >= $hget(Opers,1).item) { 
        if ($me isop #xbc_opers) { cs deop #xbc_opers | .timeridle off }
        if ($me ishop #xbc_opers) { cs dehalfop #xbc_opers | .timeridle off }
      }
    }
  }
}
on *:Dialog:ADeop-Panel:*:*: {
  if ($devent == sclick) {
    if ($did == 1) {
      if ($hget(Game/Help)) { hfree Game/Help }
      hadd -m Game/Help $left($did($adp,1),1)
    }
    if ($did == 4) {
      if ($hget(Opers)) { hfree Opers }
      hadd -m Opers $left($did($adp,4),2)
    }
  }
  if ($devent == init) {
    var %x 5
    var %y 15
    while (%x <= %y) {
      did -a $adp 4 %x Minutes
      inc %x
    }
    var %x 2
    var %y 8
    while (%x <= %y) {
      did -a $adp 1 %x Minutes
      inc %x
    }
    if ($hget(Game/Help)) { did -c $adp 1 $didwm($adp,1,$hget(Game/Help,1).item Minutes) }
    if (!$hget(Game/Help)) { did -c $adp 1 6 }
    if ($hget(Opers)) { did -c $adp 4 $didwm($adp,4,$hget(Opers,1).item Minutes) }
    if (!$hget(Opers)) { did -c $adp 4 4 }
  }
}

alias adp { return ADeop-Panel }


-Kurdish_Assass1n
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
You need to /hsave the hash tables if you don't want to lose them. It's usually a good idea to do an /hsave whenever you change something in the table. You could just do it on EXIT, but a crash could make you lose any unsaved data.

Then, when you create the table when starting mIRC, use /hload to get the data back into the table.


Invision Support
#Invision on irc.irchighway.net
Joined: Aug 2005
Posts: 525
S
Fjord artisan
Offline
Fjord artisan
S
Joined: Aug 2005
Posts: 525
You need to save the tables on exit/change and load them on start.

/help /hsave
/help /hload

Looks like Riamus beat me to it :P

Last edited by schaefer31; 03/01/07 07:57 PM.
schaefer31 #168104 03/01/07 08:07 PM
Joined: Apr 2006
Posts: 400
K
Fjord artisan
OP Offline
Fjord artisan
K
Joined: Apr 2006
Posts: 400
ok, I thought it would be hsave/load, thanks guys.


-Kurdish_Assass1n

Link Copied to Clipboard