Jump to content

Export , Import Room Access


general

Recommended Posts

;Export - $2 $3 : $+ $5-
on *:DIALOG:msn.access*:sclick:16: {
  var %a, %x $dname, %l $calc($hget(%x,num) - 1), %f access- $+ $mkfn($active) $+ .txt
  if ($isfile($scriptdir $+ %f)) .remove " $+ $scriptdir $+ %f $+ "
  while (%l >= 1) {
    %a = $hget(%x,%l)
    write " $+ $scriptdir $+ %f $+ " $gettok(%a,1-3,32) : $+ $gettok(%a,5-,32)
    dec %l
  }
  %f = $input(Access list was saved successfully to: $+ $crlf $+ %f ,68,Access saved)
}

;Import
on *:DIALOG:msn.access*:sclick:17: {
  var %f " $+ $$sfile($scriptdir $+ *.txt,Choose a saved access list to import,Import) $+ "
  if ($hget(msn.accimp)) {
    echo $color(info2) -at * Please wait, already importing a access list
    return
  }
  hmake msn.accimp 3
  hload -n msn.accimp %f
  %msnt.accimp = 1
  did -rab $dname 1 Importing Access list, please wait...
  did -r $dname 4
  .timer. $+ msn.accimp -m 0 500 msn.accimport msn.accimp
}

alias msn.accimport {
  if ($hget($1,%msnt.accimp) == $null) {
    if ($dialog(msn.access)) {
      did -ra msn.access 1 Retrieving Access list...
      access $active
    }
    .timer. $+ $1 off
    unset %msnt.accimp
    hfree $1
  }
  else {
    access $active ADD $remove($hget($1,%msnt.accimp),ï»؟)
    inc %msnt.accimp
  }
}

i paste these codes from accesslist......and it finctions as

on *:DIALOG:msn.access*:sclick:17:

though it works cool but i want to do same by just typing command if im added admin level in sceipt...

i tried to make it work ..but i culdnt ...if you can help with this please?

Link to comment
Share on other sites

Guest Travis

You would retrieve the access list.

 

/access $chan list

 

then the info comes in on raw 803 - 805.

 

803: <room name> Start of access entries

 

804: access entries

 

805: <room name> :End of access entries

 

 

So on raw 804 you write to your file. Text files are slow so I would suggest writing to ini or write to a hash table and then write the hash table to a text file.

Link to comment
Share on other sites

Hard to get these things ......

to retrive the room access by command im using following codes...

 

On Level5:TEXT:!chk*:#:{
  msg # ( Finding Access Entries For $msn.get($cid,fullroom) )
  enable #acms
  access $chan
}
#acms off
raw 804:*:{ set %acn $calc(%acn + 1) | amsg # ( .: $+ %acn $+ :. $3 for $+ $4 $+ ) }
raw 805:*:{ amsg # ( End Of Access Entries ) | unset %acn | disable #acms }
raw 804:*:{ set %acn $calc(%acn + 1) | amsg # ( .: $+ %acn $+ :. $3 for $+ $4 $+ ) }
raw 805:*:{ amsg # ( End Of Access Entries ) | unset %acn | disable #acms }
#acms end

Now tell me how it wud save in .ini file by typing command and then reload to script if it is lost?

Can u please make these two commands ?

 

Link to comment
Share on other sites

Guest Travis

Well, a raw 804 event looks like this.

 

<your nick> <channel> <level> <mask> <duration> <set by> <notes>

 

So its up to you what you want to save and how you want to index it. I will show you how to index them by the mask.

 

raw 804:*:/writeini access.ini $2 $4 $3-

 

 

This will write the entries to a file called access.ini. Inside it will look like this:

 

[Channel Name]

Mask=<level> <mask> <duration> <setby> <notes>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...