Raised This Month: $51 Target: $400
 12% 

req: Simple IP log plugin needed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
iggy_bus
BANNED
Join Date: Oct 2005
Old 09-07-2008 , 20:06   req: Simple IP log plugin needed
Reply With Quote #1

hi,

I need a plugin thad will log IPs of every player connected to a server in a txt file. (if possible unique IPs only)

I have around 120 CS 1.6 servers and I really don't have time to edit CS logs so I would really appreciate if someone could code this

thanks ahead
iggy_bus is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 09-07-2008 , 21:07   Re: req: Simple IP log plugin needed
Reply With Quote #2

Unique IPs wouldn't be practical unless you're deleting the file often as it could get quite CPU intensive upon every player connection as the log grows.
Using a database, such as MySQL, would presumably be better for your intent and ignoring duplicates would be much less costly.

Again, depending on your intent, you could download a trial version of PowerGREP and use a regular expression to parse through your various log folders, returning solely the IP. PowerGREP would also allow you to limit it to unique matches.
__________________
Brad is offline
Sofeltis
Member
Join Date: Nov 2007
Old 09-12-2008 , 17:36   Re: req: Simple IP log plugin needed
Reply With Quote #3

Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN ""
#define VERSION ""
#define AUTHOR ""

new toggle;
public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR);
    toggle = register_cvar("ip_log","1");
}
public client_connect(id)
{
    if(get_pcvar_num(toggle) != 1) return;
    IP_Log(id);
}
IP_Log(id)
{
    new szFile[128];
    get_configsdir(szFile,127);
    formatex(szFile,127,"%s/ip_log.txt",szFile);
    
    if(!file_exists(szFile))
    {
        write_file(szFile,"Ips Connected",-1);
        write_file(szFile," ",-1)
    }
    new name[32],ip[32],sztime[54],szLog[256];
    get_user_name(id,name,31);
    get_user_ip(id,ip,31);
    get_time("%m.%d.%Y -- %H:%M:%S",sztime,53);
    
    formatex(szLog,255,"Player: %s. IP: %s. Date: %s",name,ip,sztime);
    write_file(szFile,szLog,-1);
}

Here you go...
__________________
Sofeltis is offline
iggy_bus
BANNED
Join Date: Oct 2005
Old 09-12-2008 , 18:25   Re: req: Simple IP log plugin needed
Reply With Quote #4

thx man, +4 you
works fine
iggy_bus is offline
Sofeltis
Member
Join Date: Nov 2007
Old 09-13-2008 , 10:50   Re: req: Simple IP log plugin needed
Reply With Quote #5

ma nema problema...
__________________
Sofeltis is offline
Ibrahim
BANNED
Join Date: May 2012
Location: sharjah
Old 06-29-2012 , 16:10   Re: req: Simple IP log plugin needed
Reply With Quote #6

where to place ip_log.txt?
Ibrahim is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 06-29-2012 , 16:13   Re: req: Simple IP log plugin needed
Reply With Quote #7

Quote:
Originally Posted by Ibrahim View Post
where to place ip_log.txt?
It's automatically created.
__________________
<VeCo> is offline
Ibrahim
BANNED
Join Date: May 2012
Location: sharjah
Old 06-30-2012 , 05:38   Re: req: Simple IP log plugin needed
Reply With Quote #8

Thanks

Last edited by Ibrahim; 06-30-2012 at 05:40.
Ibrahim is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:02.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode