/*Квары:
connect_client_msg <1|2|3> (по-умолчанию 1)
connect_client_msg 1 - Показывает сообщение в чат только тогда, когда игрок соединяется на сервер.
connect_client_msg 2 - Показывает сообщение в чат только тогда, когда игрок присоединился за команду.
connect_client_msg 3 - Показывет сообщение в чат тогда, когда игрок соединяется на сервер и когда присоединился за команду.
connect_client_msg 4 - Показывет сообщение в чат тогда, когда игрок присоединился за команду и когда вышел с сервера.
connect_client_msg 5 - Показывет сообщение в чат тогда,когда игрок соединяется на сервер и когда вышел с сервера.
connect_client_msg 6 - Показывает сообщение во время соединения, присоединения за команду и выхода с сервера игрока.
connect_client_country <1|0> - Показывает страну (по-умолчанию 1)
connect_client_ip <1|0> - Показывает IP-адрес (по-умолчанию 1)
connect_client_authid <1|0> - Показывает аутентификацию (по-умолчанию 1)
*/
#include <amxmodx>
#include <amxmisc>
#include <geoip>
#define MAXPLAYER 32
new id_send;
new temp;
new TeamInfo;
new SayText;
new g_CvarJoinMsg;
new g_CvarJoinCountry;
new g_CvarJoinIp;
new g_CvarJoinAuthId;
new bool:IsConnected[MAXPLAYER + 1];
new g_szSoundFile[] = "buttons/blip1.wav";
public plugin_init()
{
register_plugin("Connect IP Client", "1.0", "hunter");
register_dictionary("connect_ip_client.txt")
g_CvarJoinMsg = register_cvar("connect_client_msg", "1")
g_CvarJoinCountry = register_cvar("connect_client_country", "1")
g_CvarJoinIp = register_cvar("connect_client_ip", "1")
g_CvarJoinAuthId = register_cvar("connect_client_authid", "1")
TeamInfo = get_user_msgid("TeamInfo");
SayText = get_user_msgid("SayText");
}
public plugin_precache()
{
precache_sound(g_szSoundFile);
}
public client_putinserver(player)
{
temp=get_pcvar_num(g_CvarJoinMsg);
IsConnected[player] = true;
if((temp >= 2 && temp<=4) || temp>=6)
{
show_msg(player,"CONNECT_IP_JOINED")
client_cmd(0,"hud_saytext_time 8")
client_cmd(0,"hud_deathnotice_time 8") //lol just my own remove if needed
client_cmd(0, "spk %s", g_szSoundFile)
}
}
public client_disconnect(player)
{
if(get_pcvar_num(g_CvarJoinMsg) >= 4)
{
IsConnected[player] = false;
show_msg(player,"CONNECT_IP_DISCONNECTED");
}
}
public client_authorized(player)
{
temp=get_pcvar_num(g_CvarJoinMsg);
IsConnected[player] = false;
if(temp == 1 || temp==3 || temp>=5) show_msg(player,"CONNECT_IP_CONNECTING")
}
public show_msg(player,lang_msg[]){
new authid[35],user[32],ip[32],Country[33],msg[200],len;
get_user_name(player,user,31)
get_user_ip(player,ip,31,1)
get_user_authid(player,authid,34)
geoip_country(ip,Country)
len=format(msg,199,"^x04%s ^x01",user);
if (get_pcvar_num(g_CvarJoinIp)==1) len+=format(msg[len],199,"(^x03%s^x01)",ip);
if (get_pcvar_num(g_CvarJoinAuthId)==1) len+=format(msg[len],199," (^x03%s^x01)",authid);
len+=format(msg[len],199," %L",player,lang_msg);
if (get_pcvar_num(g_CvarJoinCountry)==1) len+=format(msg[len],199," (^x03%s^x01)",Country);
format(msg[len],199,".");
print_in_chat(0, msg);
}
public print_in_chat(id, const msg[])
{
if(id && IsConnected[id]) id_send=id
else id_send=get_player()
if (id_send!=-1)
{
new team;
team = get_user_team(id_send);
static message[256];
vformat(message, 255, msg, 3);
message[192] = '^0';
Team_Info(id_send,"TERRORIST");
message_begin(MSG_ALL, SayText, {0, 0, 0}, id);
write_byte(id_send);
write_string(message);
message_end();
TeamSelection(id_send, team);
}
return 1;
}
Team_Info(id, team[])
{
message_begin(MSG_ALL, TeamInfo);
write_byte(id);
write_string(team);
message_end();
return 1;
}
TeamSelection(index, team)
{
switch(team)
{
case 0:
{
Team_Info(index, "");
}
case 1:
{
Team_Info(index, "TERRORIST");
}
case 2:
{
Team_Info(index, "CT");
}
case 3:
{
Team_Info(index, "SPECTATOR");
}
}
}
get_player()
{
for( new plr = 1; plr <= MAXPLAYER; plr++ )
{
if( IsConnected[plr] )
{
return plr;
}
}
return -1;
}