need a logs plugin that saves that connects to the server as in the example below
[15.06 - 00:09] Player GGzBoy (AUTHID /// IP) connected.
plugin infologs connect
-
m0ney
Извън линия - Потребител
- Мнения: 285
- Регистриран на: 13 Апр 2020, 11:36
- Се отблагодари: 83 пъти
- Получена благодарност: 39 пъти
- Обратна връзка:
plugin infologs connect
Untested, cvars and more info -> https://forums.alliedmods.net/showthread.php?t=63507
Код за потвърждение: Избери целия код
/*
* _______ _ _ __ __
* | _____/ | | | | \ \ __ / /
* | | | | | | | | / \ | |
* | | | |____| | | |/ __ \| |
* | | ___ | ______ | | / \ |
* | | |_ | | | | | | / \ |
* | | | | | | | | | | | |
* | |____| | | | | | | | | |
* |_______/ |_| |_| \_/ \_/
*
*
*
* Last Edited: 12-06-09
*
* ============
* Changelog:
* ============
*
* v1.1
* -Bug Fixes
*
* v1.0
* -Initial Release
*
* v1.2
* -Logging connections to file
*
*/
#define VERSION "1.2"
#include <amxmodx>
#include <amxmisc>
#include <geoip>
#define SHOW_COLOR 1
#define SHOW_CONNECT 2
#define SHOW_DISCONNECT 4
#define PLAY_SOUND_CONNECT 8
#define PLAY_SOUND_DISCONNECT 16
#define LOG_CONNECTED
new display_type_pcvar
new name[33][32]
new authid[33][32]
new country[33][46]
new ip[33][32]
new connect_soundfile[64]
new disconnect_soundfile[64]
#if defined LOG_CONNECTED
new const g_szLogFile[] = "addons/amxmodx/logs/connected.log";
#endif
new saytext_msgid
public plugin_init()
{
register_plugin("GHW Connect Messages",VERSION,"GHW_Chronic - Edit by m0ney")
display_type_pcvar = register_cvar("cm_flags","31")
register_cvar("cm_connect_string","[AMXX] %name (%steamid) has connected (%country).")
register_cvar("cm_disconnect_string","[AMXX] %name (%steamid) has disconnected (%country).")
saytext_msgid = get_user_msgid("SayText")
}
public plugin_precache()
{
register_cvar("cm_connect_sound","buttons/bell1.wav")
register_cvar("cm_disconnect_sound","fvox/blip.wav")
get_cvar_string("cm_connect_sound",connect_soundfile,63)
get_cvar_string("cm_disconnect_sound",disconnect_soundfile,63)
precache_sound(connect_soundfile)
precache_sound(disconnect_soundfile)
}
public client_putinserver(id)
{
if(!is_user_bot(id))
{
get_client_info(id)
new display_type = get_pcvar_num(display_type_pcvar)
if(display_type & SHOW_CONNECT)
{
new string[200]
get_cvar_string("cm_connect_string",string,199)
format(string,199,"^x01%s",string)
if(display_type & SHOW_COLOR)
{
new holder[46]
format(holder,45,"^x04%s^x01",name[id])
replace(string,199,"%name",holder)
format(holder,45,"^x04%s^x01",authid[id])
replace(string,199,"%steamid",holder)
format(holder,45,"^x04%s^x01",country[id])
replace(string,199,"%country",holder)
format(holder,45,"^x04%s^x01",ip[id])
replace(string,199,"%ip",holder)
}
else
{
replace(string,199,"%name",name[id])
replace(string,199,"%steamid",authid[id])
replace(string,199,"%country",country[id])
replace(string,199,"%ip",ip[id])
}
new num, players[32], player
get_players(players,num,"ch")
for(new i=0;i<num;i++)
{
player = players[i]
message_begin(MSG_ONE,saytext_msgid,{0,0,0},player)
write_byte(player)
write_string(string)
message_end()
if(display_type & PLAY_SOUND_CONNECT)
{
new stringlen = strlen(connect_soundfile)
if(connect_soundfile[stringlen - 1]=='v' && connect_soundfile[stringlen - 2]=='a' && connect_soundfile[stringlen - 3]=='w') //wav
{
client_cmd(player,"spk ^"sound/%s^"",connect_soundfile)
}
if(connect_soundfile[stringlen - 1]=='3' && connect_soundfile[stringlen - 2]=='p' && connect_soundfile[stringlen - 3]=='m') //wav
{
client_cmd(player,"mp3 play ^"sound/%s^"",connect_soundfile)
}
#if defined LOG_CONNECTED
log_to_file(g_szLogFile, "[CONNECTED] Player %name [ID: %steamid] [IP: %ip]", name[id], authid[id], ip[id]);
#endif
}
}
}
}
}
public get_client_info(id)
{
get_user_name(id,name[id],31)
get_user_authid(id,authid[id],31)
get_user_ip(id,ip[id],31)
geoip_country(ip[id],country[id])
if(equal(country[id],"error"))
{
if(contain(ip[id],"192.168.")==0 || equal(ip[id],"127.0.0.1") || contain(ip[id],"10.")==0 || contain(ip[id],"172.")==0)
{
country[id] = "LAN"
}
if(equal(ip[id],"loopback"))
{
country[id] = "ListenServer User"
}
else
{
country[id] = "Unknown Country"
}
}
}
public client_infochanged(id)
{
if(!is_user_bot(id))
{
get_user_info(id,"name",name[id],31)
}
}
public client_disconnect(id)
{
if(!is_user_bot(id))
{
new display_type = get_pcvar_num(display_type_pcvar)
if(display_type & SHOW_DISCONNECT)
{
new string[200]
get_cvar_string("cm_disconnect_string",string,199)
format(string,199,"^x01%s",string)
if(display_type & SHOW_COLOR)
{
new holder[46]
format(holder,45,"^x04%s^x01",name[id])
replace(string,199,"%name",holder)
format(holder,45,"^x04%s^x01",authid[id])
replace(string,199,"%steamid",holder)
format(holder,45,"^x04%s^x01",country[id])
replace(string,199,"%country",holder)
format(holder,45,"^x04%s^x01",ip[id])
replace(string,199,"%ip",holder)
}
else
{
replace(string,199,"%name",name[id])
replace(string,199,"%steamid",authid[id])
replace(string,199,"%country",country[id])
replace(string,199,"%ip",ip[id])
}
new num, players[32], player
get_players(players,num,"ch")
for(new i=0;i<num;i++)
{
player = players[i]
message_begin(MSG_ONE,saytext_msgid,{0,0,0},player)
write_byte(player)
write_string(string)
message_end()
new stringlen = strlen(disconnect_soundfile)
if(disconnect_soundfile[stringlen - 1]=='v' && disconnect_soundfile[stringlen - 2]=='a' && disconnect_soundfile[stringlen - 3]=='w') //wav
{
client_cmd(player,"spk ^"sound/%s^"",disconnect_soundfile)
}
if(disconnect_soundfile[stringlen - 1]=='3' && disconnect_soundfile[stringlen - 2]=='p' && disconnect_soundfile[stringlen - 3]=='m') //wav
{
client_cmd(player,"mp3 play ^"sound/%s^"",disconnect_soundfile)
}
}
}
}
}
-
impossible
Извън линия - Потребител
- Мнения: 488
- Регистриран на: 15 Юни 2019, 12:41
- Се отблагодари: 23 пъти
- Получена благодарност: 47 пъти
plugin infologs connect
the file is created automatically in the folder cstrike/addons/amxmodx/configs/ip_log.txt
Код за потвърждение: Избери целия код
#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);
}
-
- Подобни теми
- Отговори
- Преглеждания
- Последно мнение
-
- 2 Отговори
- 323 Преглеждания
-
Последно мнение от Toni_P
-
- 2 Отговори
- 430 Преглеждания
-
Последно мнение от Stilex
-
- 2 Отговори
- 1090 Преглеждания
-
Последно мнение от Radeon
-
- 4 Отговори
- 1662 Преглеждания
-
Последно мнение от OciXCrom
-
- 2 Отговори
- 423 Преглеждания
-
Последно мнение от HeatoN
-
- 8 Отговори
- 3258 Преглеждания
-
Последно мнение от mi0
-
- 5 Отговори
- 1084 Преглеждания
-
Последно мнение от stanchew.k
Кой е на линия
Потребители разглеждащи този форум: 0 регистрирани и 9 госта