Half-Life и Adrenaline Gamer форум

Всё об игре в Халф-Лайф и АГ
Текущее время: 30 апр 2024, 20:42

Часовой пояс: UTC + 5 часов [ Летнее время ]




Начать новую тему Ответить на тему  [ Сообщений: 2 ] 
Автор Сообщение
 Заголовок сообщения: ip log plugin
СообщениеДобавлено: 04 янв 2012, 03:13 
Не в сети
Зарегистрирован:
07 сен 2011, 12:20
Последнее посещение:
31 июл 2015, 18:31
Сообщения: 74
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);
}

_________________
Изображение


Вернуться к началу
 Профиль 
  
 Заголовок сообщения: Re: ip log plugin
СообщениеДобавлено: 07 янв 2012, 17:07 
Не в сети
Зарегистрирован:
07 сен 2011, 12:20
Последнее посещение:
31 июл 2015, 18:31
Сообщения: 74
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);

_________________
Изображение


Вернуться к началу
 Профиль 
  
Показать сообщения за:  Поле сортировки  
Начать новую тему Ответить на тему  [ Сообщений: 2 ] 

Часовой пояс: UTC + 5 часов [ Летнее время ]


Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 4


Вы не можете начинать темы
Вы не можете отвечать на сообщения
Вы не можете редактировать свои сообщения
Вы не можете удалять свои сообщения
Вы не можете добавлять вложения

Найти:
Перейти:  
cron
Создано на основе phpBB® Forum Software © phpBB Group
Русская поддержка phpBB