Junior Member
|
03-01-2013
, 21:08
Re: Lame Connection Punisher 1.2
|
#125
|
Quote:
Originally Posted by DUBMANJEIRE
Hi,
I've been testing this plugin for a few weeks now using the default settings.
It seems to work but I notice that for me, it does not punish all bad connections or as fast as it should do.
I have seen many players with ping from 50-250+ and their ping is jumping all over the place far above the 50 Ping Flux default and it seems to take a long time for them to be punished/kicked or in many examples they are not punished at all...?
Also, as it seems a bit unreliable we probably have to add a HPK also to deal with Latency on server by multiple high pings, however stable their connection is.
I would like to know what best settings are or if there is something am missing before adding HPK?
It also seems that we can't have 25-50 low ping players enjoying a game with 250+ high ping players as there are too many complaints about lag, teleporting and hitbox/reg issues even though the high ping players have stable connections...
So at the moment, this plugin works but we will also need a HPK for Max. 300+ pings and also to reduce latency on servers.
Still testing.. as always..
EDIT: It is in the plugins.ini under 3rd Party at the top with minimal other plugins..
Does it matter or work better/faster if I change it's order in the file?
:-J
|
It's probably because we use a custom plugin, maybe someone can check what is wrong with it:
Code:
#include <amxmodx>
#include <amxmisc>
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]
new g_Ping[33]
new g_Samples[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 Con/Ping Punisher", "1.21", "MeRcyLeZZ (edit mp3)")
register_dictionary("lame_connection_punisher.txt")
register_concmd("amx_hpk","cmdHpk",ADMIN_KICK,"- configures high_ping_kicker plugin")
register_cvar("amx_hpk_ping","150")
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 )
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)
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 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)
}
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
}
__________________
|
|