All pastes #595705 Raw Edit

Unnamed

public text v1 · immutable
#595705 ·published 2007-06-29 16:44 UTC
rendered paste body
wbadd {
  ;usage = /wbadd {nick} {wb}
  ;read the first wb for the user
  %wb = $readini($mircdirWBs.ini,$1,1)
  var %i = 1
  ;calculate how many WBs the user has
  while (%wb) {
    inc %i
    %wb = $readini($mircdirWBs.ini,$1,%i)
  }
  ;add the next wb
  writeini $mircdirWBs.ini $1 %i $2
  ;$rand(0,9)
}
wbread {
  ;usage = /wbread {nick} {channel}
  ;read the first wb for the user
  %wb = $readini($mircdirWBs.ini,$1,1)
  if(%wb) {
    var %i = 1
    ;calculate how many WBs the user has
    while (%wb) {
      inc %i
      %wb = $readini($mircdirWBs.ini,$1,%i)
    }
    %i = %i - 1
    %x = $rand(1,%i)
    %wb = $readini($mircdirWBs.ini,$1,%x)
    /say %2 -WB %x - %wb
  }
}