Търся AFK KICKER, който да не засяга Spectators.

В този раздел можете да подавате всякакви заявки за намиране, изработка или преработка на плъгини/модове.
Аватар
sf4n
Извън линия
Потребител
Потребител
Мнения: 311
Регистриран на: 08 Яну 2018, 11:25
Се отблагодари: 25 пъти
Получена благодарност: 14 пъти

Търся AFK KICKER, който да не засяга Spectators.

Мнение от sf4n » 16 Мар 2018, 20:31

Та обяснил съм точно,ясно и накратко в заглавието и мисля, че няма какво още да добявям :dance:
Изображение

Единствен по рода си Zombie BaseBuilder с уникален мод и коректни админи по всяко време в сървъра.
IP: bb.cs-zapad.eu:27013

Respawn сървър.
IP: re.cs-zapad.eu:27015

Furien сървър.
IP: fu.cs-zapad.eu:27016

Нашият Сайт
Нашият Форум

Аватар
DoPe ;]]
Извън линия
Потребител
Потребител
Мнения: 402
Регистриран на: 27 Фев 2017, 22:10
Обратна връзка:

Търся AFK KICKER, който да не засяга Spectators.

Мнение от DoPe ;]] » 16 Мар 2018, 20:34

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cstrike>
#include <engine>
#include <WPMGPrintChatColor>

#define VERSION "1.1a"

#define KICK_IMMUNITY ADMIN_IMMUNITY

enum _:iPunishments
{
	KICK = 1,
	REDIRECT
}

new p_iMaxPing, p_flMaxAfkTime, p_flMaxSpecTime, p_iPingCheckTime, p_iPunishWay, 
p_szRedirectIP, g_iMaxPlayers;
new iPingChecks[33], iUserTotalPing[33], Float:flUserAfkTime[33], bool:blPrintedWarn[33];

new const g_iCheckButtons = ( IN_ATTACK | IN_JUMP | IN_DUCK | IN_FORWARD | IN_BACK | IN_USE | IN_CANCEL | IN_LEFT | IN_RIGHT | IN_MOVELEFT | IN_MOVERIGHT | IN_ATTACK2 | IN_RUN | IN_RELOAD | IN_ALT1 | IN_SCORE );

new const szCheckerClass[] = "kick_manager_checker";

public plugin_init()
{
	register_plugin("Afk & High ping Kicker", VERSION, "TheRedShoko @ AMXX-BG.Info");
	register_cvar("afk_hp_kicker", VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED);
	
	p_iMaxPing = register_cvar("kick_manager_maxping", "120");
	p_flMaxAfkTime = register_cvar("kick_manager_afktime", "90.0");
	p_flMaxSpecTime = register_cvar("kick_manager_spectime", "30.0");
	p_iPingCheckTime = register_cvar("kick_manager_pingtime", "5");
	p_iPunishWay = register_cvar("kick_manager_punish", "1");
	p_szRedirectIP = register_cvar("kick_manager_redirectip", "127.0.0.1:27015");
	
	new iEnt = create_entity("info_target");
	
	if (iEnt)
	{
		register_think(szCheckerClass, "CheckUsersStatus");
		
		entity_set_string(iEnt, EV_SZ_classname, szCheckerClass);
		entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1);
	}
	
	g_iMaxPlayers = get_maxplayers();
}

public client_putinserver(id)
{
	ClearVariables(id);
}

public CheckUsersStatus(iEnt)
{
	if (!is_valid_ent(iEnt)) return;
	
	static iUserPing, iUserLoss;
	
	static Float:flMaxAfkTime;
	flMaxAfkTime = get_pcvar_float(p_flMaxAfkTime);
	
	static Float:flMaxSpecTime;
	flMaxSpecTime = get_pcvar_float(p_flMaxSpecTime);
	
	static iMaxPing;
	iMaxPing = get_pcvar_num(p_iMaxPing);
	
	static iPunishment;
	iPunishment = get_pcvar_num(p_iPunishWay);
	
	static szRedirectIP[16];
	if (iPunishment == REDIRECT)
	{
		get_pcvar_string(p_szRedirectIP, szRedirectIP, charsmax(szRedirectIP));
	}
	
	static szPunishment[32];
	
	switch (iPunishment)
	{
		case KICK: formatex(szPunishment, charsmax(szPunishment), "kicked");
		case REDIRECT: formatex(szPunishment, charsmax(szPunishment), "redirected");
	}
	
	for (new i = 1; i <= g_iMaxPlayers; i++)
	{
		if (!is_user_connected(i) || is_user_bot(i) || get_user_flags(i) & KICK_IMMUNITY) continue;
		
		if (cs_get_user_team(i) == CS_TEAM_SPECTATOR || cs_get_user_team(i) == CS_TEAM_UNASSIGNED)
		{
			flUserAfkTime[i] += 0.1;
			
			if (flMaxSpecTime - flUserAfkTime[i] <= 15.0 && !blPrintedWarn[i])
			{
				PrintChatColor(i, PRINT_COLOR_PLAYERTEAM, "!g[!tSpecKicker!g]!y You will get %s after!g 15!y seconds for being spectator!",
				szPunishment);
				blPrintedWarn[i] = true;
			}
			
			if (flUserAfkTime[i] >= flMaxSpecTime)
			{
				new szName[32];
				get_user_name(i, szName, charsmax(szName));
				
				PrintChatColor(0, PRINT_COLOR_PLAYERTEAM, "!g[!tSpecKicker!g]!y Player!g %s!y got %s for being!t Spectator!y for more than!t %i!y seconds!",
				szName, szPunishment, floatround(flMaxSpecTime));
				
				switch (iPunishment)
				{
					case KICK: server_cmd("kick #%i ^"You got kicked for being afk more than %i seconds!^"", get_user_userid(i), floatround(flMaxSpecTime));
					case REDIRECT: client_cmd(i, "wait;wait;wait;wait;wait;^"connect^" %s", szRedirectIP);
				}
				
				ClearVariables(i);
			}
		}
		else if (!(entity_get_int(i, EV_INT_button) & g_iCheckButtons) && is_user_alive(i))
		{
			flUserAfkTime[i] += 0.1;
			
			if (flMaxAfkTime - flUserAfkTime[i] <= 15.0 && !blPrintedWarn[i])
			{
				PrintChatColor(i, PRINT_COLOR_PLAYERTEAM, "!g[!tAfkKicker!g]!y You will get %s after!g 15!y seconds for being AFK!",
				szPunishment);
				blPrintedWarn[i] = true;
			}
			
			if (flUserAfkTime[i] >= flMaxAfkTime)
			{
				new szName[32];
				get_user_name(i, szName, charsmax(szName));
				
				PrintChatColor(0, PRINT_COLOR_PLAYERTEAM, "!g[!tAfkKicker!g]!y Player!g %s!y got %s for being!t AFK!y for more than!t %i!y seconds!",
				szName, szPunishment, floatround(flMaxAfkTime));
				
				switch (iPunishment)
				{
					case KICK: server_cmd("kick #%i ^"You got kicked for being afk more than %i seconds!^"", get_user_userid(i), floatround(flMaxAfkTime));
					case REDIRECT: client_cmd(i, "wait;wait;wait;wait;wait;^"connect^" %s", szRedirectIP);
				}
				
				ClearVariables(i);
			}
		}
		else
		{
			flUserAfkTime[i] = 0.0;
			blPrintedWarn[i] = false;
		}
		
		get_user_ping(i, iUserPing, iUserLoss);
		iUserTotalPing[i] += iUserPing;
		iPingChecks[i]++;
		
		if (iPingChecks[i] >= get_pcvar_num(p_iPingCheckTime) && (iUserTotalPing[i] / iPingChecks[i]) >= iMaxPing)
		{
			new szName[32];
			get_user_name(i, szName, charsmax(szName));
				
			PrintChatColor(0, PRINT_COLOR_PLAYERTEAM, "!g[!tHighPingKicker!g]!y Player!g %s!y got %s for having more than!t AFK!y for more than!t %ims!y!",
			szName, szPunishment, iMaxPing);
			
			switch (iPunishment)
			{
				case KICK: server_cmd("kick #%i ^"You got kicked for having more more than %ims!^"", get_user_userid(i), iMaxPing);
				case REDIRECT: client_cmd(i, "wait;wait;wait;wait;wait;^"connect^" %s", szRedirectIP);
			}
			
			ClearVariables(i);
		}
	}
	
	entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1);
}

ClearVariables(id)
{
	flUserAfkTime[id] = 0.0;
	iPingChecks[id] = 0;
	iUserTotalPing[id] = 0;
	blPrintedWarn[id] = false;
}
The Best Deathrun Server: 79.124.49.91:27019
The Best Respawn Server: 79.124.49.88:27021

Аватар
sf4n
Извън линия
Потребител
Потребител
Мнения: 311
Регистриран на: 08 Яну 2018, 11:25
Се отблагодари: 25 пъти
Получена благодарност: 14 пъти

Търся AFK KICKER, който да не засяга Spectators.

Мнение от sf4n » 16 Мар 2018, 20:36

Дал си ми HighPingKicker
Изображение

Единствен по рода си Zombie BaseBuilder с уникален мод и коректни админи по всяко време в сървъра.
IP: bb.cs-zapad.eu:27013

Respawn сървър.
IP: re.cs-zapad.eu:27015

Furien сървър.
IP: fu.cs-zapad.eu:27016

Нашият Сайт
Нашият Форум

Аватар
DoPe ;]]
Извън линия
Потребител
Потребител
Мнения: 402
Регистриран на: 27 Фев 2017, 22:10
Обратна връзка:

Търся AFK KICKER, който да не засяга Spectators.

Мнение от DoPe ;]] » 16 Мар 2018, 20:36

register_plugin("Afk & High ping Kicker"
The Best Deathrun Server: 79.124.49.91:27019
The Best Respawn Server: 79.124.49.88:27021

Аватар
Punch*
Извън линия
Потребител
Потребител
Мнения: 143
Регистриран на: 15 Фев 2018, 20:12
Получена благодарност: 1 път
Обратна връзка:

Търся AFK KICKER, който да не засяга Spectators.

Мнение от Punch* » 16 Мар 2018, 22:23

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cstrike>
#include <engine>
#include <WPMGPrintChatColor>

#define VERSION "1.2a"

#define KICK_IMMUNITY ADMIN_IMMUNITY

enum _:iPunishments
{
	KICK = 1,
	REDIRECT
}

new p_iMaxPing, p_flMaxAfkTime, p_iPingCheckTime, p_iPunishWay, 
p_szRedirectIP, p_bChatMessages, g_iMaxPlayers;
new iPingChecks[33], iUserTotalPing[33], Float:flUserAfkTime[33], bool:blPrintedWarn[33];

new const g_iCheckButtons = ( IN_ATTACK | IN_JUMP | IN_DUCK | IN_FORWARD | IN_BACK | IN_USE | IN_CANCEL | IN_LEFT | IN_RIGHT | IN_MOVELEFT | IN_MOVERIGHT | IN_ATTACK2 | IN_RUN | IN_RELOAD | IN_ALT1 | IN_SCORE );

new const szCheckerClass[] = "kick_manager_checker";

public plugin_init()
{
	register_plugin("Afk & High ping Kicker", VERSION, "TheRedShoko @ AMXX-BG.Info");
	register_cvar("afk_hp_kicker", VERSION, FCVAR_SERVER|FCVAR_SPONLY|FCVAR_UNLOGGED);
	
	p_iMaxPing = register_cvar("kick_manager_maxping", "150");
	p_flMaxAfkTime = register_cvar("kick_manager_afktime", "90.0");
	p_iPingCheckTime = register_cvar("kick_manager_pingtime", "5");
	p_iPunishWay = register_cvar("kick_manager_punish", "1");
	p_szRedirectIP = register_cvar("kick_manager_redirectip", "127.0.0.1:27015");
	p_bChatMessages = register_cvar("kick_manager_chatmessages", "1");

	new iEnt = create_entity("info_target");
	
	if (iEnt)
	{
		register_think(szCheckerClass, "CheckUsersStatus");
		
		entity_set_string(iEnt, EV_SZ_classname, szCheckerClass);
		entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1);
	}
	
	g_iMaxPlayers = get_maxplayers();
}

public client_putinserver(id)
{
	ClearVariables(id);

	if (get_pcvar_num(p_bChatMessages))
	{
		set_task(2.0, "ShowMessages", id);
	}
}

public ShowMessages(id)
{
	new szPunishment[32];
	GetPunishmentString(get_pcvar_num(p_iPunishWay), szPunishment, charsmax(szPunishment));

	PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[High Ping Kicker]!y Players with ping higher than!t %d!y will be %s!", get_pcvar_num(p_iMaxPing), szPunishment);
	PrintChatColor(id, PRINT_COLOR_PLAYERTEAM, "!g[AFK Kicker]!y Player who are being AFK for more than!t %.0f!y will be %s", get_pcvar_num(p_flMaxAfkTime), szPunishment);
}

public CheckUsersStatus(iEnt)
{
	if (!is_valid_ent(iEnt)) return;
	
	static iUserPing, iUserLoss;
	
	static Float:flMaxAfkTime;
	flMaxAfkTime = get_pcvar_float(p_flMaxAfkTime);
	
	static iMaxPing;
	iMaxPing = get_pcvar_num(p_iMaxPing);
	
	static iPunishment;
	iPunishment = get_pcvar_num(p_iPunishWay);
	
	static szRedirectIP[16];
	if (iPunishment == REDIRECT)
	{
		get_pcvar_string(p_szRedirectIP, szRedirectIP, charsmax(szRedirectIP));
	}
	
	static szPunishment[32];
	GetPunishmentString(iPunishment, szPunishment, charsmax(szPunishment));
	
	for (new i = 1; i <= g_iMaxPlayers; i++)
	{
		if (!is_user_connected(i)) continue;

#if defined KICK_IMMUNITY
		if (get_user_flags(i) & KICK_IMMUNITY) continue
#endif	
		if (!(entity_get_int(i, EV_INT_button) & g_iCheckButtons) && is_user_alive(i))
		{
			flUserAfkTime[i] += 0.1;
			
			if (flMaxAfkTime - flUserAfkTime[i] <= 15.0 && !blPrintedWarn[i] && get_pcvar_num(p_bChatMessages))
			{
				PrintChatColor(i, PRINT_COLOR_PLAYERTEAM, "!g[!tAfkKicker!g]!y You will get %s after!g 15!y seconds for being AFK!",
				szPunishment);
				blPrintedWarn[i] = true;
			}
			
			if (flUserAfkTime[i] >= flMaxAfkTime)
			{
				if (get_pcvar_num(p_bChatMessages))
				{
					new szName[32];
					get_user_name(i, szName, charsmax(szName));
				
					PrintChatColor(0, PRINT_COLOR_PLAYERTEAM, "!g[!tAfkKicker!g]!y Player!g %s!y got %s for being!t AFK!y for more than!t %i!y seconds!",
					szName, szPunishment, floatround(flMaxAfkTime));
				}
				
				switch (iPunishment)
				{
					case KICK: server_cmd("kick #%i ^"You got kicked for being afk more than %i seconds!^"", get_user_userid(i), floatround(flMaxAfkTime));
					case REDIRECT: client_cmd(i, "wait;wait;wait;wait;wait;^"connect^" %s", szRedirectIP);
				}
				
				ClearVariables(i);
			}
		}
		else
		{
			flUserAfkTime[i] = 0.0;
			blPrintedWarn[i] = false;
		}
		
		get_user_ping(i, iUserPing, iUserLoss);
		iUserTotalPing[i] += iUserPing;
		iPingChecks[i]++;
		
		if (iPingChecks[i] >= get_pcvar_num(p_iPingCheckTime) && (iUserTotalPing[i] / iPingChecks[i]) >= iMaxPing)
		{
			if (get_pcvar_num(p_bChatMessages))
			{
				new szName[32];
				get_user_name(i, szName, charsmax(szName));
				
				PrintChatColor(0, PRINT_COLOR_PLAYERTEAM, "!g[!tHighPingKicker!g]!y Player!g %s!y got %s for having more than!t %ims!y!",
				szName, szPunishment, iMaxPing);
			}
			
			switch (iPunishment)
			{
				case KICK: server_cmd("kick #%i ^"You got kicked for having more more than %ims!^"", get_user_userid(i), iMaxPing);
				case REDIRECT: client_cmd(i, "wait;wait;wait;wait;wait;^"connect^" %s", szRedirectIP);
			}
			
			ClearVariables(i);
		}
	}
	
	entity_set_float(iEnt, EV_FL_nextthink, get_gametime() + 0.1);
}

ClearVariables(id)
{
	flUserAfkTime[id] = 0.0;
	iPingChecks[id] = 0;
	iUserTotalPing[id] = 0;
	blPrintedWarn[id] = false;
}

GetPunishmentString(iPunishment, szString[], len)
{
	switch (iPunishment)
	{
		case KICK: formatex(szString, len, "kicked");
		case REDIRECT: formatex(szString, len, "redirected");
	}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1026\\ f0\\ fs16 \n\\ par }
*/

Публикувай отговор
  • Подобни теми
    Отговори
    Преглеждания
     Последно мнение

Обратно към “Заявки за плъгини”

Кой е на линия

Потребители разглеждащи този форум: 0 регистрирани и 14 госта