Избор на HighPingKicker

Въпроси и проблеми свързани с AMXModX.
Аватар
smurfavr
Извън линия
Потребител
Потребител
Мнения: 426
Регистриран на: 06 Окт 2016, 17:55
Се отблагодари: 25 пъти
Получена благодарност: 16 пъти
Обратна връзка:

Избор на HighPingKicker

Мнение от smurfavr » 06 Окт 2018, 12:11

Някои може ли да каже кои от тези плъгини е за предпочитане?
1.

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

#include <amxmodx>
#include <amxmisc>

#define TASKWARN	1996
#define TASKSET 	2996
#define TASKCHECK 	3996

new g_Ping[MAX_PLAYERS +1]
new g_Samples[MAX_PLAYERS +1]

new VarPing, VarCheck, VarTest, VarDelay

public plugin_init()
{
	register_plugin("High Ping Kicker", "0.4","OLO & iceeedR") //Based on OLO version
	register_concmd("amx_hpk","cmdHpk", ADMIN_KICK, "<ping to get kicked> <checks before kicks> <time between checks> <delay before first check in sec.>")
	register_cvar("NewPingkicker", "0.4", FCVAR_SERVER | FCVAR_SPONLY )

	bind_pcvar_num(create_cvar("amx_ping","200", .description = "The maximum ping allowed before being kicked.", .has_min = true, .min_val = 0.0), VarPing)
	bind_pcvar_num(create_cvar("amx_check","3", .description = "Time between Checks", .has_min = true, .min_val = 3.0), VarCheck)
	bind_pcvar_num(create_cvar("amx_tests","5", .description = "Checkcount", .has_min = true, .min_val = 0.0), VarTest)
	bind_pcvar_num(create_cvar("amx_delay","15", .description = "Delay between checks", .has_min = true, .min_val = 3.0), VarDelay)

	AutoExecConfig(.autoCreate = true, .name = "HighPingKicker")
}

public client_disconnected(id) 
 	remove_task(id + TASKCHECK)

public client_putinserver(id) 
{    
	g_Ping[id] = g_Samples[id] = 0
	

	if(!is_user_bot(id))
	{
		set_task_ex( 10.0 , "showWarn" , id + TASWARN, .flags = SetTask_Once)
	    
		if (VarTest != 0) 
		{
			set_task_ex( float(VarDelay), "taskSetting", id + TASKSET, .flags = SetTask_Once)
		}
		else 
		{	    
			set_task_ex( float(VarCheck) , "checkPing" , id + TASKCHECK, .flags = SetTask_Repeat)
		}
	
	}
} 

public showWarn(taskId)
{
	new id = taskId - TASKWARN

	client_print_color(id, print_team_red,"^x04[HPK]^x01 Players with more than^x04 %d^x01 of ping will be kicked.", VarPing)
}

public taskSetting(taskId) 
{
	new id = taskId - TASKSET

	set_task_ex( float(VarCheck) , "checkPing" , id + TASKCHECK, .flags = SetTask_Repeat)
}

kickPlayer( id ) 
	server_cmd("kick #%d ^"Sorry, your ping is too high.^"",get_user_userid(id))


public checkPing(taskId) 
{ 
	new id = taskId - TASKCHECK

	if ( get_user_flags(id) & ADMIN_IMMUNITY ) return

	new Ping, Loss

	get_user_ping( id , Ping , Loss ) 

	g_Ping[ id ] += Ping
	++g_Samples[ id ]

	if((g_Samples[ id ] >= VarTest) && (g_Ping[id] / g_Samples[id]) >= VarPing)
	{
		remove_task(id + TASKCHECK)
		client_print_color(id, print_team_red,"^x04[HPK]^x01 Player^x04 %n^x01 has been disconnected because his ping is greater than^x04 %d.", id, VarPing)
		kickPlayer(id) 
	}  	
}

  
public cmdHpk(id,level,cid)
{
	if (!cmd_access(id,level,cid,4))
		return PLUGIN_HANDLED

	set_pcvar_num(VarPing,read_argv_int(1))
   	set_pcvar_num(VarCheck,read_argv_int(2))
  	set_pcvar_num(VarTest,read_argv_int(3))
   	set_pcvar_num(VarDelay,read_argv_int(4))

   	console_print(id, "Current High_Ping_Kicker Settings:")
   	console_print(id, "Maxping: %d Time between Checks: %d Checkcount: %d Delay: %d", VarPing, VarCheck, VarTest, VarDelay)

	return PLUGIN_HANDLED    
}
2.

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

/* AMX Mod script
* 
* (c) 2002-2003, DynAstY
* This file is provided as is (no warranties).
*
* Players with immunity won't be checked
*/

#include <amxmodx>

new HIGHPING_MAX = 200 // set maximal acceptable ping
new HIGHPING_TIME = 15  // set in seconds frequency of ping checking
new HIGHPING_TESTS = 8  // minimal number of checks before doing anything

new iNumTests[33]

public plugin_init() {
	register_plugin("High Ping Kicker","1.2.0","DynAstY")
	if (HIGHPING_TIME < 15) HIGHPING_TIME = 15
	if (HIGHPING_TESTS < 4) HIGHPING_TESTS = 4
	return PLUGIN_CONTINUE
}

public client_disconnect(id) {
	remove_task(id)
	return PLUGIN_CONTINUE
}
	
public client_putinserver(id) {
	iNumTests[id] = 0
	if (!is_user_bot(id)) {
		new param[1]
		param[0] = id
		set_task(30.0, "showWarn", id, param, 1)
	}
	return PLUGIN_CONTINUE
}

kickPlayer(id) {
	new name[32]
	get_user_name(id, name, 31)
	new uID = get_user_userid(id)
	server_cmd("banid 1 #%d", uID)
	client_cmd(id, "echo ^"[HPK] Sorry but you have high ping, try later...^"; disconnect")
	client_print(0, print_chat, "[HPK] %s was disconnected due to high ping!", name)
	return PLUGIN_CONTINUE
} 

public checkPing(param[]) {
	new id = param[0]
	if ((get_user_flags(id) & ADMIN_IMMUNITY) || (get_user_flags(id) & ADMIN_RESERVATION)) {
		remove_task(id)
		client_print(id, print_chat, "[HPK] Ping checking disabled due to immunity...")
		return PLUGIN_CONTINUE
	}
	new p, l
	get_user_ping(id, p, l)
	if (p > HIGHPING_MAX)
		++iNumTests[id]
	else
		if (iNumTests[id] > 0) --iNumTests[id]
	if (iNumTests[id] > HIGHPING_TESTS)
		kickPlayer(id)
	return PLUGIN_CONTINUE
}

public showWarn(param[]) {
	client_print(param[0], print_chat, "[HPK] Players with ping higher than %dms will be kicked!", HIGHPING_MAX)
	set_task(float(HIGHPING_TIME), "checkPing", param[0], param, 1, "b")
	return PLUGIN_CONTINUE
}

3.

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

/* Yet another High Ping Kicker
About:
This plugin kick players that have to high a ping, or too low a cl_updaterate/rate setting. It also has a 
option to adds X amount to the max ping when the clock is goes over 24.
The plugin can also automaticly update client settings ( Showing a menu to the client ) or just update his setinfo field ( this will cause the settings lost once he closes HL1)

Forum Thread: http://www.amxmodx.org/forums/viewtopic.php?t=7865

Credits:
Ops in #AMXmod @ Quakenet for alot of help ( + AssKicR  & CheesyPeteza ) 

Install:
Install the plugin like any other
Put these into your amxx.cfg with the correct vaules
amx_maxping 125
amx_minrate 10000
amx_minupdaterate 40
amx_maxping_add 50

Changelog:
 1.1.4
 	- Added: Define UseSetInfo so you can change if you want to use client_cmd() instead of setinfo
 
 1.1.2
 	- Fixed: Typo in log_amx()
	- Added: #define To disable cl_updaterate on the client.
	- Added: Automaticly changeing client settings without chaning the cvar ( Just changeing the setinfo field instead )
	- Added: Also checks the clients Rate setting ( cvar: amx_minrate )
	- Added: amx_minupdaterate The lowest accetable client updaterate
	
 1.1.1
 	- Fixed: Task not being removed when player left.
 1.1.0
 	- Added: Shows a menu to ppl with too low a cl_updaterate settings
 	 
 1.0.0
 	- First released version
*/

#include <amxmodx>

#define TaskTime 15.0
#define HowManyChecks 10
#define ExtraPing 150		// ExtraPing + g_MaxPing : If a user has a ping above this, his ping Offense counter goes up 5 instead of 1

#define MAXPLAYERS 32
#define CheckUpdateRate 1	// 1 = Uses menu  | 2 = auto changes settings
#define UseSetInfo  1

new g_PingOffence[MAXPLAYERS+1]
new g_CheckPlayer[MAXPLAYERS+1]		// To save the poor cpu having to keep track of the connected players
new g_MaxPing

#if CheckUpdateRate != 0
new g_MinUpdateRate
new g_MinRate
#endif
new g_MaxPlayers

#define PluginVersion "1.1.4"

public plugin_init() 
{
	register_plugin("Yet Another High Ping Kicker",PluginVersion,"EKS")
#if CheckUpdateRate == 1
	register_menucmd(register_menuid("\yToo low cl_updaterate:"),1023,"MenuCheckSelection")
#endif
  	
#if CheckUpdateRate != 0
   	register_cvar("amx_minupdaterate","40")
	register_cvar("amx_minrate","10000")
#endif
	register_cvar("amx_maxping","200")
	register_cvar("amx_maxping_add","50")
	
	register_cvar("yhpk_version",PluginVersion,FCVAR_SERVER)
	set_task(TaskTime,"Task_CheckPlayers",64,_,_,"b")
	return PLUGIN_CONTINUE
}
public plugin_cfg()
{
	g_MaxPlayers = get_maxplayers()
	g_MaxPing = get_cvar_num("amx_maxping")
	
#if CheckUpdateRate != 0
	g_MinUpdateRate = get_cvar_num("amx_minupdaterate")
	g_MinRate = get_cvar_num("amx_minrate")
#endif

	new sTimeH[4] // Contains the hour in a sting
	get_time("%H",sTimeH,3) 
	new TimeH = str_to_num(sTimeH)
	if (TimeH < 14)
	{
		g_MaxPing = g_MaxPing + get_cvar_num("amx_maxping_add")
		server_print("[HPK] Time is %d, added +%d to maxping(%d)",TimeH,get_cvar_num("amx_maxping_add"),g_MaxPing)
	}
	else
		server_print("[HPK] Time is %d, maxping(%d)",TimeH,g_MaxPing)
}
public client_putinserver(id) 
{
	if(is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id))
		set_task(20.0,"Task_ActivatePingCheck",id,_,_,"a",1)		// Since when the user "just" connected, his ping is high, we dont want to get a false detection
}
public Task_ActivatePingCheck(id) 
{
	g_PingOffence[id] = 0
	g_CheckPlayer[id] = 1
#if CheckUpdateRate != 0	
	client_print(id,print_chat,"[HPK] The max ping is %d, and lowest acceptable cl_updaterate is %d",g_MaxPing,g_MinUpdateRate)
#else
	client_print(id,print_chat,"[HPK] The max ping is %d",g_MaxPing)
#endif
}

public client_disconnect(id) 
{
	g_CheckPlayer[id] = 0
	remove_task(id)
}
public Task_CheckPlayers()
{
	for(new i=1;i<=g_MaxPlayers;i++) if(g_CheckPlayer[i])
		CheckPing(i)
}

stock CheckPing(id)
{
#if CheckUpdateRate != 0
	new TempString[10]
	get_user_info(id,"cl_updaterate",TempString,9)
	new clrate = str_to_num(TempString)
	get_user_info(id,"rate",TempString,9)
	new rate = str_to_num(TempString) 
#endif

	new ping,loss
	get_user_ping(id,ping,loss)

	if(ping > g_MaxPing)
	{
		if(ping >= ExtraPing+g_MaxPing) g_PingOffence[id] = g_PingOffence[id] + 5		// If the user has a ping ExtraPing + g_MaxPing, he gets +5 instead of +1 in his ping offence counter
		else g_PingOffence[id]++
		
		if(g_PingOffence[id] >= HowManyChecks)
		{
			new Name[32],Auth[35]
			get_user_name(id,Name,31)
			get_user_authid(id,Auth,34)
			client_print(0,print_chat,"[HPK] %s was kicked for having a ping above %d",Name,g_MaxPing)
			server_cmd("kick #%d Ping too high",get_user_userid(id))
			log_amx("%s<%s> was kicked for having to high a ping (was %d)",Name,Auth,ping)
			return PLUGIN_CONTINUE
		}
		client_print(id,print_chat,"[HPK] You ping is above %d, either fix your ping or leave",g_MaxPing)
	}
#if CheckUpdateRate == 1
	if(clrate < g_MinUpdateRate || rate < g_MinRate)
	{
		if(g_CheckPlayer[id] == 1 || g_CheckPlayer[id] == 3)
		{
		    ShowMenu(id)
		    
		    if(g_CheckPlayer[id] == 3)
			    g_CheckPlayer[id] = 2
		    else
		    {
			    g_CheckPlayer[id] = 2
		    }
		}
	}
	else if(clrate < g_MinUpdateRate && g_CheckPlayer[id] == 2)
	{
		new Name[32],Auth[35]
		get_user_name(id,Name,31)
		get_user_authid(id,Auth,34)
		client_print(0,print_chat,"[HPK] %s was kicked for having a too low cl_updaterate(%d)/rate(%d)",Name,clrate,rate)
		server_cmd("kick #%d Too low a cl_updaterate",get_user_userid(id))	
		log_amx("%s<%s> was kicked for having too low a cl_updaterate(%d)/rate(%d)",Name,Auth,clrate,rate)
		return PLUGIN_CONTINUE
	}
#endif
#if CheckUpdateRate == 2
	if(clrate < g_MinUpdateRate)
	{
#if UseSetInfo == 1
		format(TempString,9,"%d",g_MinUpdateRate)
		set_user_info(id,"cl_updaterate",TempString)
#else
	        client_cmd(id,"cl_updaterate %d",g_MinUpdateRate)
#endif
		client_print(id,print_chat,"[HPK] Your updaterate was increased to %d",g_MinUpdateRate)
	}
	if(rate < g_MinRate)
	{
#if UseSetInfo == 1
		format(TempString,9,"%d",g_MinRate)
		set_user_info(id,"rate",TempString)
#else
	        client_cmd(id,"rate %d",g_MinRate)
#endif
		client_print(id,print_chat,"[HPK] Your rate was increased to %d",g_MinRate)		
	}
#endif

	//client_print(id,3,"%d had ping: %d(%d) loss %d clrate %d(%d) Rate: %d (%d)",id,ping,g_MaxPing,loss,clrate,g_MinUpdateRate,rate,g_MinRate)
	return PLUGIN_CONTINUE
}

#if CheckUpdateRate == 1
public ShowMenu(id)
{ 
	new szMenuBody[151] 
	new len,keys 
	len = format(szMenuBody,255,"\yToo low cl_updaterate/rate:^n Increase the cl_updaterate/rate or leave the server")
	len += format(szMenuBody[len],150 - len,"^n\w 1. Increase to %d",g_MinUpdateRate) 
	len += format(szMenuBody[len],150 - len,"^n\w 2. Leave server") 


	keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9) 
	show_menu( id, keys, szMenuBody, -1 ) 
	return PLUGIN_CONTINUE 
}
public MenuCheckSelection(id,key) // Called by ShowReadyMenu
{ 
	new Name[32],Auth[35]
	get_user_name(id,Name,31)
	get_user_authid(id,Auth,34)
	
	if(key == 0) 
	{
		client_print(0,print_chat,"[HPK] %s choose to update his cl_updaterate/rate",Name)
		log_amx("%s<%s> choose to update his cl_updaterate/rate",Name,Auth)		
		client_cmd(id,"cl_updaterate %d",g_MinUpdateRate)
		client_cmd(id,"rate %d",g_MinRate)
	}
	else if(key == 1)
	{
		client_print(0,print_chat,"[HPK] %s choose not to update his cl_updaterate/rate",Name)
		server_cmd("kick #%d Too low cl_updaterate/rate",get_user_userid(id))	
		log_amx("%s<%s> choose to NOT update his cl_updaterate/rate",Name,Auth)
	}
	else	// Made a wrong selection
		ShowMenu(id)

	return PLUGIN_CONTINUE
}
#endif
4.

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

/*================================================================================
	
	------------------------------------
	-*- Lame Connection Punisher 1.2 -*-
	------------------------------------
	
	~~~~~~~~~~~~~~~
	- Description -
	~~~~~~~~~~~~~~~
	
	This plugin improves your server's gameplay experience by automatically
	rejecting clients with "bad" conections, so that you'll never have to
	deal with players skipping around the map or being hard to hit anymore.
	
	It can also detect clients running any background applications that may
	be affecting their connection, such as P2P programs using up too many
	bandwidth.
	
	~~~~~~~~~~~~~~~~~~~~
	- How Does It Work -
	~~~~~~~~~~~~~~~~~~~~
	
	It checks for player's ping fluctuations and packet loss rates, since
	these seem to be the most trustable factors in determining if there are
	any issues, in my experience.
	
	~~~~~~~~~~~~~~~~~~~~~~~~~~~
	- What Makes It Different -
	~~~~~~~~~~~~~~~~~~~~~~~~~~~
	
	Other solutions, such as Hing Ping Kickers, usually can't tell apart
	players with good or bad connections accurately. They may not detect
	a bad connection if the player's ping is too low, and likewise, they
	may end up kicking a player who's ping exceeds the limit but has a
	nice connection nonetheless, thus making you loose potential players.
	
	~~~~~~~~~
	- CVARS -
	~~~~~~~~~
	
	There are 2 main cvars to control the plugin's behavior (tolerance),
	though the default values are recommended.
	
	Please note that small ping fluctuations and packet loss occur even
	on the best connections, so DO NOT set these too low, unless you are
	in for some nasty results!
	
	* lcp_flux_limit [50] - Ping fluctuation limit (in ms.)
	* lcp_loss_limit [5] - Loss limit (% of packets)
	
	Additionally, you can specify whether the plugin should kick or ban
	these players by changing the following settings.
	
	* lcp_punishment [0/1/2] - 0 = Kick / 1 = Ban by SteamID / 2 = Ban by IP
	* lcp_ban_time [5] - Ban time in minutes (use 0 to permanently ban)
	
	Lastly, players with the immunity flags will not be checked at all.
	
	* lcp_immunity ["a"] - Immunity flags
	
	~~~~~~~~~~~~~
	- Changelog -
	~~~~~~~~~~~~~
	
	* v1.0: (Jan 05, 2009)
	   - Public release
	   - Added ban support
	   - Added immunity feature
	
	* v1.1: (Feb 08, 2009)
	   - Code optimized
	
	* v1.1a: (Feb 24, 2009)
	   - Fixed IP ban code retrieving unneeded port number
	
	* v1.2: (Jun 06, 2011)
	   - Fixed plugin so that it works on all HL mods
	
=================================================================================*/

#include <amxmodx>

const TASK_JOINMSG = 100
const TASK_DOCHECKS = 200
#define ID_JOINMSG (taskid-TASK_JOINMSG)

new cvar_flux, cvar_loss, cvar_punishment, cvar_bantime, cvar_immunity
new g_maxplayers, g_connected[33]
new g_lastping[33], g_fluxcounter[33], g_losscounter[33], g_immune[33]

// I wouldn't recommend lowering these unless
// you wanna pick up a lot of false positives
const Float:CHECK_FREQ = 5.0
const FLUX_TESTS = 12
const LOSS_TESTS = 12

public plugin_init()
{
	register_plugin("Lame Connection Punisher", "1.2", "MeRcyLeZZ")
	register_dictionary("lame_connection_punisher.txt")
	
	cvar_flux = register_cvar("lcp_flux_limit", "50")
	cvar_loss = register_cvar("lcp_loss_limit", "5")
	cvar_punishment = register_cvar("lcp_punishment", "0")
	cvar_bantime = register_cvar("lcp_ban_time", "5")
	cvar_immunity = register_cvar("lcp_immunity", "a")
	g_maxplayers = get_maxplayers()
}

public plugin_cfg()
{
	// Start checking players
	set_task(CHECK_FREQ, "do_checks", TASK_DOCHECKS, _, _, "b")
}

public client_putinserver(id)
{
	set_task(16.0, "join_message", id+TASK_JOINMSG)
	g_connected[id] = true
	check_flags(id)
}

public client_authorized(id)
{
	check_flags(id)
}

public client_infochanged(id)
{
	check_flags(id)
}

public client_disconnect(id)
{
	remove_task(id+TASK_JOINMSG)
	g_fluxcounter[id] = 0
	g_losscounter[id] = 0
	g_lastping[id] = 0
	g_immune[id] = 0
	g_connected[id] = false
}

public do_checks()
{
	static id, ping, loss, name[32], auth[32], userid, minutes
	
	for (id = 1; id <= g_maxplayers; id++)
	{
		if (!g_connected[id] || g_immune[id])
			continue;
		
		get_user_ping(id, ping, loss)
		
		if (loss > get_pcvar_num(cvar_loss))
			g_losscounter[id]++
		else if (g_losscounter[id] > 0)
			g_losscounter[id]--
		
		if (g_losscounter[id] >= LOSS_TESTS)
		{
			get_user_name(id, name , sizeof name - 1)
			userid = get_user_userid(id)
			
			switch (get_pcvar_num(cvar_punishment))
			{
				case 1:
				{
					get_user_authid(id, auth, sizeof auth - 1)
					minutes = get_pcvar_num(cvar_bantime)
					
					if (minutes > 0)
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_BAN", name, minutes)
						log_amx("%L", LANG_SERVER, "MSG_ALL_BAN", name, minutes)
						server_cmd("kick #%d ^"%L^";wait;banid %d ^"%s^";wait;writeid", userid, id, "MSG_TARGET_LOSS", minutes, auth)
					}
					else
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_PBAN", name)
						log_amx("%L", LANG_SERVER, "MSG_ALL_PBAN", name)
						server_cmd("kick #%d ^"%L^";wait;banid 0 ^"%s^";wait;writeid", userid, id, "MSG_TARGET_LOSS", auth)
					}
				}
				case 2:
				{
					get_user_ip(id, auth, sizeof auth - 1, 1)
					minutes = get_pcvar_num(cvar_bantime)
					
					if (minutes > 0)
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_BAN", name, minutes)
						log_amx("%L", LANG_SERVER, "MSG_ALL_BAN", name, minutes)
						server_cmd("kick #%d ^"%L^";wait;addip %d ^"%s^";wait;writeip", userid, id, "MSG_TARGET_LOSS", minutes, auth)
					}
					else
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_PBAN", name)
						log_amx("%L", LANG_SERVER, "MSG_ALL_PBAN", name)
						server_cmd("kick #%d ^"%L^";wait;addip 0 ^"%s^";wait;writeip", userid, id, "MSG_TARGET_LOSS", auth)
					}
				}
				default:
				{
					client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_KICK", name)
					log_amx("%L", LANG_SERVER, "MSG_ALL_KICK", name)
					server_cmd("kick #%d ^"%L^"", userid, id, "MSG_TARGET_LOSS")
				}
			}
			continue;
		}
		
		if (abs(ping - g_lastping[id]) > get_pcvar_num(cvar_flux))
			g_fluxcounter[id]++
		else if (g_fluxcounter[id] > 0)
			g_fluxcounter[id]--
		
		if (g_fluxcounter[id] >= FLUX_TESTS)
		{
			get_user_name(id, name , sizeof name - 1)
			userid = get_user_userid(id)
			
			switch (get_pcvar_num(cvar_punishment))
			{
				case 1:
				{
					get_user_authid(id, auth, sizeof auth - 1)
					minutes = get_pcvar_num(cvar_bantime)
					
					if (minutes > 0)
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_BAN", name, minutes)
						log_amx("%L", LANG_SERVER, "MSG_ALL_BAN", name, minutes)
						server_cmd("kick #%d ^"%L^";wait;banid %d ^"%s^";wait;writeid", userid, id, "MSG_TARGET_FLUX", minutes, auth)
					}
					else
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_PBAN", name)
						log_amx("%L", LANG_SERVER, "MSG_ALL_PBAN", name)
						server_cmd("kick #%d ^"%L^";wait;banid 0 ^"%s^";wait;writeid", userid, id, "MSG_TARGET_FLUX", auth)
					}
				}
				case 2:
				{
					get_user_ip(id, auth, sizeof auth - 1, 1)
					minutes = get_pcvar_num(cvar_bantime)
					
					if (minutes > 0)
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_BAN", name, minutes)
						log_amx("%L", LANG_SERVER, "MSG_ALL_BAN", name, minutes)
						server_cmd("kick #%d ^"%L^";wait;addip %d ^"%s^";wait;writeip", userid, id, "MSG_TARGET_FLUX", minutes, auth)
					}
					else
					{
						client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_PBAN", name)
						log_amx("%L", LANG_SERVER, "MSG_ALL_PBAN", name)
						server_cmd("kick #%d ^"%L^";wait;addip 0 ^"%s^";wait;writeip", userid, id, "MSG_TARGET_FLUX", auth)
					}
				}
				default:
				{
					client_print(0, print_chat, "[AMXX] %L", LANG_PLAYER, "MSG_ALL_KICK", name)
					log_amx("%L", LANG_SERVER, "MSG_ALL_KICK", name)
					server_cmd("kick #%d ^"%L^"", userid, id, "MSG_TARGET_FLUX")
				}
			}
			continue;
		}
		
		g_lastping[id] = ping
	}
}

public join_message(taskid)
{
	client_print(ID_JOINMSG, print_chat, "[AMXX] %L", ID_JOINMSG, "JOIN_MSG", get_pcvar_num(cvar_flux), get_pcvar_num(cvar_loss))
}

check_flags(id)
{
	new flags[6]
	get_pcvar_string(cvar_immunity, flags, charsmax(flags))
	g_immune[id] = get_user_flags(id) & read_flags(flags)
}
5.

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

/* AMX Mod script. 
* 
* (c) 2002-2003, OLO 
* modified by shadow
* This file is provided as is (no warranties). 
* 
* Players with immunity won't be checked 
*/ 

#include <amxmodx> 
#include <amxmisc>

new g_Ping[33]
new g_Samples[33]

public plugin_init()
{
  register_plugin("High Ping Kicker (WON)","0.16.2","OLO/shadow")
  register_concmd("amx_hpk","cmdHpk",ADMIN_KICK,"- configures high_ping_kicker plugin")
  register_cvar("amx_hpk_ping","200")
  register_cvar("amx_hpk_check","12")
  register_cvar("amx_hpk_tests","5")
  register_cvar("amx_hpk_delay","60")
  
  if ( get_cvar_num( "amx_hpk_check" ) < 5 ) set_cvar_num( "amx_hpk_check" , 5 )
  if ( get_cvar_num( "amx_hpk_tests" ) < 3 ) set_cvar_num( "amx_hpk_tests" , 3 )
}

public client_disconnect(id) 
  remove_task( id )

public client_putinserver(id) 
{    
  g_Ping[id] = 0 
  g_Samples[id] = 0

  if ( !is_user_bot(id) ) 
  {
    new param[1]
    param[0] = id 
    set_task( 10.0 , "showWarn" , id , param , 1 )
    
    if (get_cvar_num("amx_hpk_tests") != 0) {
	    set_task( float(get_cvar_num("amx_hpk_delay")), "taskSetting", id, param , 1)
    }
    else {	    
    	set_task( float(get_cvar_num( "amx_hpk_tests" )) , "checkPing" , id , param , 1 , "b" )
	}
	
  }
} 

public showWarn(param[])
  client_print( param[0] ,print_chat,"* Players with ping higher than %d will be kicked!", get_cvar_num( "amx_hpk_ping" ) )

public taskSetting(param[]) {
	new name[32]
	get_user_name(param[0],name,31)
	set_task( float(get_cvar_num( "amx_hpk_tests" )) , "checkPing" , param[0] , param , 1 , "b" )
}

kickPlayer( id ) 
{ 
	new name[32],authid[32]
	get_user_name(id,name,31)
	get_user_authid(id,authid,31)

  	client_print(0,print_chat,"** Player %s disconnected due to high ping",name)
	client_cmd(id,"echo ^"** Sorry but you have too high ping, try later...^";disconnect")
	remove_task(id)
	log_amx("Highpingkick: ^"%s<%d><%s>^" was kicked due highping (Average Ping ^"%d^")", 
    name,get_user_userid(id),authid,(g_Ping[id] / g_Samples[id]))

} 

public checkPing(param[]) 
{ 
  new id = param[ 0 ] 

  if ( get_user_flags(id) & ADMIN_IMMUNITY ) return

  new p, l 

  get_user_ping( id , p , l ) 

  g_Ping[ id ] += p
  ++g_Samples[ id ]

  if ( (g_Samples[ id ] > get_cvar_num( "amx_hpk_tests" )) && (g_Ping[id] / g_Samples[id] > get_cvar_num( "amx_hpk_ping" ))  )    
    kickPlayer(id) 
}

  
public cmdHpk(id,level,cid){
  if (!cmd_access(id,level,cid,1))
    return PLUGIN_HANDLED
    
  new ping[5]
  new check_arr[5]
  new tests_arr[5]
  new delay_arr[5]
  read_argv(1,ping,4)
  read_argv(2,check_arr,4)
  read_argv(3,tests_arr,4)
  read_argv(4,delay_arr,4)
  
  new check = str_to_num(check_arr)
  new tests = str_to_num(tests_arr)
  new delay = str_to_num(delay_arr)
  
  
  if ( check < 5 ) check = 5
  if ( tests < 3 ) tests = 3
  

  if (read_argc() > 1){
    set_cvar_string("amx_hpk_ping",ping)
  }
  if (read_argc() > 2) {
	set_cvar_num("amx_hpk_check",check)
  }
  if (read_argc() > 3) {
	set_cvar_num("amx_hpk_tests",tests)
  }
  if (read_argc() > 4) {
	  set_cvar_num("amx_hpk_delay",delay)
 }

  console_print(id,"Syntax: amx_hpk <ping to get kicked> <checks before kicks> <time between checks> <delay before first check in sec.>")
  console_print(id,"Current High_Ping_Kicker Settings:")
  console_print(id,"Maxping: %d  Time between checks: %d Checkcount: %d Delay: %d",get_cvar_num("amx_hpk_ping"),get_cvar_num("amx_hpk_check"),get_cvar_num("amx_hpk_tests"),get_cvar_num("amx_hpk_delay"))
  return PLUGIN_HANDLED    
}

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

Обратно към “Поддръжка / Помощ”

Кой е на линия

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