Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

ip log plugin
http://aghl.ru/forum/viewtopic.php?f=28&t=601
Страница 1 из 1

Автор:  neoRT [ 04 янв 2012, 03:13 ]
Заголовок сообщения:  ip log plugin

Hi guys! Can you help me with this plugin? It logs ips that were connected to the server and looks something like this:
Player: Player. IP: 181.1.55.230:53711. Date: 01.03.2012 -- 21:36:50
Can someone make it to also log the authid before or after the ip?

Код:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Log IP"
#define VERSION "1.0"
#define AUTHOR "Anakin"

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);
}

Автор:  neoRT [ 07 янв 2012, 17:07 ]
Заголовок сообщения:  Re: ip log plugin

Lol the solution was very easy :|

Don't delete my post because maybe the plugin will be usefull to other people.

Код:
#include <amxmodx> 
#include <amxmisc>

#define PLUGIN "Log IP"
#define VERSION "1.0"
#define AUTHOR "Anakin"

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], szAuthID[32];
    get_user_name(id,name,31);
    get_user_ip(id,ip,31);
    get_user_authid(id, szAuthID, charsmax(szAuthID));
    get_time("%m.%d.%Y -- %H:%M:%S",sztime,53);
     
    formatex(szLog,255,"Player: %s IP: %s SteamID: %s Date: %s",name,ip, szAuthID, sztime);
    write_file(szFile,szLog,-1);

Страница 1 из 1 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/