mIRC Home    About    Download    Register    News    Help

Print Thread
#219367 15/03/10 02:39 AM
Joined: Jun 2004
Posts: 133
S
state Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
What would be the best way to log all users who joins my channel.

I want this information stored in a text file or something.

But, if a user joins with the same address but different name it would log "nick is also nickTwo @address bla bla"

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
What information are you wanting to log?

As to letting you know about one or more people using the same address, there are several Clone scripts available.

Joined: Jun 2004
Posts: 133
S
state Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
Hello Russel, i just want the name and address of the user to be logged.

but if they later say in the week come in with a different name the log file will be able to show this.

I don't need to be able to visually see this, inside mirc.

Just a text file

Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
hi
do you mean you want a detector for changed Nickname


WorldDMT
Joined: Jun 2004
Posts: 133
S
state Offline OP
Vogon poet
OP Offline
Vogon poet
S
Joined: Jun 2004
Posts: 133
I just want EVERY user who joins to be logged

But it would be easier to view who had joined under different names if they was logged next to each other

make sense????

Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
so something like this

Code:
on !*:join:#channel:{
  if ($hget(Ndata,$wildsite)) echo 3 -a $nick was $v1
  hadd -m Ndata $wildsite $nick
}
on *:exit:hsave Ndata nick.data
on *:start:{
  if $isfile(nick.data) {
    hmake Ndata
    hload Ndata nick.data
  }
}

i didnt test the code i dont have mIRC now


WorldDMT
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Here's a quick code.
Code:
on *:start:{
  if !$hget(tracker) { .hmake tracker 100 }
  if $exists($scriptdirtracker.hsh) {    .hload tracker $scriptdirtracker.hsh  }
}
on *:exit:  .hsave tracker $scriptdirtracker.hsh
on *:disconnect:  .hsave tracker $scriptdirtracker.hsh
on *:join:#:{
  .hadd -m tracker $address $addtok($hget(tracker,$address),$nick,32)
  if $hget(tracker,$address) {
    echo $chan $address recognized as $hget(tracker,$address)
  }
}


Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I would recommend including previous nicks when adding new ones so that you keep a record of all nicks:

Code:
hadd -m Ndata $wildsite $hget(Ndata,$wildsite) $nick


I also really recommend saving when you change data in hash tables rather than only when you exit. Otherwise, you lose all changes if mIRC crashes. Unless the data isn't important, of course. It's also not a bad idea to include a hash table "size" when creating it as it speeds up access. Also, it can be a good idea to have an alias that checks for the saved data and loads it and creates the table anytime you want to add data rather than only on start. If someone were to load the script and start using it without restarting mIRC, the saved data wouldn't get loaded and would end up being overwritten (lost) when exiting.

Here's how I think I'd handle it.

Code:
on !*:join:#channel:{
  Ndata.check
  if ($hget(Ndata,$wildsite)) echo 3 -a $nick was $v1
  hadd Ndata $wildsite $hget(Ndata,$wildsite) $nick
  hsave Ndata nick.data
}
alias Ndata.check {
  if (!$hget(Ndata)) {
    hmake Ndata 100
    if $isfile(nick.data) { hload Ndata nick.data }
  }
}


And to the OP, the echo line is completely optional... a way to view it inside mIRC wasn't requested, so that can be removed if desired or formatted differently or whatever else.

To view the data, open the nick.data file in Wordpad or Word (not Notepad). You'll see a host line followed by all nicks attached to that host, then another host line with the nicks for that one, and so on.

Be aware that there is a limit to the number of nicks you can attach to a host (the character length of them). Chances are that you won't hit that limit on any one host because people don't usually change their nicks that much. But, if you think you will, then you'll want to use binary instead for the hash table.


Invision Support
#Invision on irc.irchighway.net
Joined: Feb 2009
Posts: 133
C
Vogon poet
Offline
Vogon poet
C
Joined: Feb 2009
Posts: 133
yeah but u have to look at if the $nick is already present in hash table or not
and why /hsave every join? for me i think is better when he exit he will save it only one time
so the code will be like this
Code:
on !*:join:#channel:{
  var %N $hget(Ndata,$wildsite)
  if (%N) echo 3 # $nick was $v1
  if (!$istok($v1,$nick,32)) hadd -m Ndata $wildsite %N $nick
}
on *:exit:.hsave Ndata nick.data
on *:start:{
  if $isfile(nick.data) {
    .hmake Ndata
    .hload Ndata nick.data
  }
}

Last edited by chacha; 16/03/10 01:56 PM.

WorldDMT
Joined: Oct 2004
Posts: 8,330
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Quote:
yeah but u have to look at if the $nick is already present in hash table or not


True. I should have used $addtok()...

Code:
  hadd Ndata $wildsite $addtok($hget(Ndata,$wildsite),$nick,32)


Of course, the separator can be something other than a space depending on preference.

And like I said regarding /hsave... if you never save except on exit/disconnect, you risk losing everything that happened the entire time you were online if mIRC or the computer crashes. Unless the data isn't important, that's not a good thing to have happen. For example, I'm online 24/7 and rarely get disconnected. If I store data for a week and then mIRC or the computer crashes for whatever reason (maybe power goes out or whatever), then all that data is lost. Unless you have a lot of joins (ever few seconds), there is very little issue with saving each time data is updated. Also, you can make it save only if the nick is new... if it's already there, you don't have to save. Though I'm not sure you'd really make it more efficient running the check instead of just saving it. If it really is an issue, then at minimum I would suggest a timer set to 5 or 10 minutes that runs on start to save the data at regular intervals. Of course, this means you might save more often than using the original method I showed, depending on the number of joins.

You also don't seem to like the advice about creating the table when needed rather than only on start. Loading the script without restarting mIRC would fail to load any saved data and therefore would overwrite that data with when you save. Not a good idea. As a note, it doesn't have to be an alias. It can be placed right into the on join event. I am just used to hash tables that are called in multiple ways and having an alias means no duplicated code. For this situation, having it in the event itself would work fine.


Invision Support
#Invision on irc.irchighway.net

Link Copied to Clipboard