C&C Renegade IP Logger

By chicknh8r on Oct 25, 2006

Copy This Snippet. In mirc, click "alt R", then go to "new". Paste and save. Now, right click to access options. When enabled, in channels that display "nickbla@123.45.67.890" this script will log "nickbla" using ip "123.45.67.890".
Make Sure to change "#channel #channel2 #channel3 #channel4" to the channels you will be in.
I had assistance in creating this from tye's trackusers script. I simply took the time to rewrite it to record Renegade Players ID's and IP's. :D

; **************************
; *** Will's Renegade IP ***
; *** Logger Using Hash ****
; ****** Version 1.0 *******
; **************************

; On Startup/Exit

on *:start: {
  ;## Creates Hash Table "renip"
  hmake -s renip
  ;## Checks If their is backup info to load
  if ($isfile(renip.dat)) { hload -s renip renip.dat }
  ;## Turns Off Script if it was left on when last closed
  disable #RENIP
  disable #RENQUERY
} 

on *:exit: {
  ;## Saves All recored info logged to backup
  hsave -o renip renip.dat
}

; On Text Events

#renip off

on *:text:*:#: {
  ;## Checks For Specific Channels
  if $istok(#channel #channel2 #channel3 #channel4,$chan,32) {
    ;## Checks if "joined" is in Text Event
    if ($2 == joined) || ($2-3 == has joined) {
      ;## Sets Channel and Nick as a variable
      var %ipname = $left($strip($1),$calc($pos($1,@,1) - 1))
      var %ipinfo = $mid($strip($1),$calc($pos($1,@,1) + 1))
      var %ipchan = #
      ;## Checks If Nick is already stored in logs and Either Creates New Account Or add's to an existing one
      if ($hget(renip,%ipname)) {
        var %rn = $ifmatch
        if ($istok(%n,%ipinfo,32)) { var %d = $remtok(%n,$findtok(%n,%ipinfo,1,32),32) }
        else { var %d = %rn }
        if (!%d) { return }
        if (!$istok(%n,%ipinfo,32)) {
          hadd renip %ipname %n %ipinfo
          ;## Sends Confirmation To Window @RENIP Of Info Successfully Logged
          if (!$window(@RENIP)) window -n @RENIP
          echo $colour(info) -t @RENIP ( $+ %ipchan $+ ) Added ( $+ %ipinfo $+ ) to ( $+ %ipname $+ 's) account.
          echo $colour(info) -t @RENP ( $+ %ipchan $+ ) %ipname has also used: %d
          ;## Free's All variables associated with "%ip*"
          unset %ip*
        }
      }
      ;## Creates New Account For %ipnick
      else {
        hadd renip %ipname %ipinfo
        if (!$window(@RENIP)) window -n @RENIP
        echo $colour(info) -t @RENIP ( $+ %ipchan $+ ) Created Account ( $+ %ipname $+ ):( $+ %ipinfo $+ ) 
        unset %ip*
      }
    }
  }
}

#renip end

#renquery off

on *:text:?ip *:#: {
  ;## Checks if trigger "?ip" is entered and if nick is halfop or fullop in channel
  if  (($1 == ?ip && $2)) {
    if ($nick ishop $chan) || ($nick isop $chan) {
      var %ipname = $2
      if ($hget(renip,%ipnick)) {
        var %rn = $ifmatch
        if ($istok(%n,%ipnick,32)) { var %d = $remtok(%n,$findtok(%n,%ipname,1,32),32) }
        else { var %d = %rn }
        if (!%d) { goto noinfo }
        notice $nick %ipnick has used the following IP $iif($numtok(%d,32) > 1,s:,:) %d
        unset %ip*
        halt
      }
      :noinfo
      notice $nick Currently No IP info logged for %ipnick
      unset %ip*
      halt
    }
  }
}

#renquery end

on *:input:*: {
  if (($1 == ?ip && $2)) {
    if ($hget(renip,$2)) {
      var %rn = $ifmatch
      if ($istok(%n,$2,32)) { var %d = $remtok(%n,$findtok(%n,$2,1,32),32) }
      else { var %d = %rn }
      if (!%d) { goto noinfo }
      echo -a $2 has used the following IP $iif($numtok(%d,32) > 1,s:,:) %d
      halt
    }
    :noinfo
    echo -a Currently No IP info logged for $2
    halt
  }
  elseif ($1 == !renip) {
    if ($2 == status) || (!$2) {
      echo -a Renegade IP Logger Currently $group(#RENIP).status
      halt
    }
    elseif ($2 == on) || ($2 == enable) {
      if ( $+ $group(#RENIP).status = on $+ ) {
        echo -a Renegade IP Logger Already Running
        halt
      }
      else {
        enable #RENIP
        echo -a Renegade IP Logger Now $group(#RENIP).status
        halt
      }
    }
    elseif ($2 == off) || ($2 == disable) {
      if ( $+ $group(#RENIP).status = off $+ ) {
        echo -a Renegade IP Logger Isn't Running
        halt
      }
      else {
        disable #RENIP
        echo -a Renegade IP Logger Now $group(#RENIP).status
        halt
      }
    }
  }
  elseif ($1 == !saveinfo) {
    hsave -o renip renip.dat
    echo -a Renegade IP Logger Info Saved!
    halt
  }
}

; Menu Section
menu channel {
  Renegade IP Logger ( $+ $iif( $+ $group(#RENIP).status = on,ENABLED,DISABLED) $+ )
  .RenIp ( $+ $iif( $+ $group(#RENIP).status = on, Turn OFF, Turn ON) $+ ) {
    %renip = $iif(%renip,0,1)
    $iif(%renip,disable,enable) #RENIP
    echo -a Renegade IP Logger $iif(%renip,ENABLED,DISABLED)
  }
  .Allow Query ( $+ $iif( $+ $group(#RENQUERY).status = on, Turn OFF, Turn ON) $+ ) {
    %renquery = $iif(%renquery,0,1)
    $iif(%renquery,disable,enable) #RENQUERY
    echo -a Allow Query $iif(%renquery,ENABLED,DISABLED)
  }
  .Add-IP: {
    var %ipnick = $$?="Enter Nick"
    var %ipinfo = $$?="Enter IP" 
    if ($hget(renip,%ipnick)) {
      var %rn = $ifmatch
      if ($istok(%n,%ipnick,32)) { var %d = $remtok(%n,$findtok(%n,%ipnick,1,32),32) }
      else { var %d = %rn }
      if (!%d) { goto create }
      hadd renip %ipnick %n %ipinfo
      if (!$window(@RENIP)) window -n @RENIP
      echo $colour(info) -t @RENIP Added ( $+ %ipinfo $+ ) to ( $+ %ipnick $+ 's) Account Info.
      unset %ip*
      halt
    }
    :create
    hadd renip %ipnick %ipinfo
    if (!$window(@RENIP)) window -n @RENIP
    echo $colour(info) -t @RENIP Created ( $+ %ipnick $+ ) ( $+ %ipinfo $+ )
    unset %ip*
    halt
  }
  .REM-IP: {
    var %ipnick = $$?="Enter Nick"
    var %ipinfo = $$?="Enter IP" 
    if ($hget(renip,%ipnick)) {
      hdel renip %ipnick
      if (!$window(@RENIP)) window -n @RENIP
      echo $colour(info) -t @RENIP Deleted Account %ipnick
      unset %ip*
      halt
    }
    else {
      echo -a %ipnick Doesnt have an Account To Delete
      unset %ip*
      halt
    }
  }
}

Comments

Sign in to comment.
darkarrow   -  Jan 27, 2009

i like this script really good but could you make it a little difrent please i need it to work with NR with useing the command !ip but theres one thing that i don't get wich is why i couldn't do it when someone joins the game it is difrent so i can't make it !ip the nick all the time here are some examples:
Supreme Commander blade1545 has joined the game, fighting for team GDI. (WOL)
Player m12major has joined the game, fighting for team GDI. (WOL)
because of ranks and this is what the !ip commands output is like:
[3:22:26pm] [~darkarrow] !ip blade1545
[3:22:28pm] [Personal Notice] bld-bot: [NR] blade1545 #0 -- 192.168.*.**
(the real one doesn't have the stars i added those for privacy)

 Respond  
Bargor   -  Aug 10, 2008

How run This script please instrution step to step

 Respond  
Freckle   -  Nov 07, 2006

Hey Chickenh8r, do you know me?
Spoiled-Freckle
my brother is Spoiled-Chicken.
hehe. nice script. I also made an ban+kick+unban logger for renegade,
it\'s good to see someone explaining his scripts

 Respond  
Hawkee   -  Oct 29, 2006

I agree about the comments krimson. They\'re very important in any programming language. Not only do they help others understand your code, but they\'re most important in helping you understand you own code. I\'ve gone back over old code of mine numerous times having no idea what I was thinking when I wrote it. The comments really help clear that up.

 Respond  
krimson   -  Oct 29, 2006

Nice to see more complex scripts around here. I\'m not really a mirc user anymore (nor c&c), but from what I could see when reading this snippet, it looks ok. I also like the fact that you comment the code; this is very important for people trying to learn msl

 Respond  
chicknh8r   -  Oct 25, 2006

Ty, please let me know how I could improve on it, im eager to learn to simplify and code better. All input appreciated! :D

 Respond  
sean   -  Oct 25, 2006

could be better but not bad, glad to see more cnc ppl here :)

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.