~thereau~ Membru Activ
Numarul mesajelor : 750 Data nasterii : 25/04/1992 Data de inscriere : 12/03/2010 Varsta : 32 Localizare : Pascani/Iasi
| Subiect: Client ratefull - highping kicker Joi Apr 22, 2010 12:21 pm | |
| Descriere: Da afara automat jucatorii care au lag. Descarcare: [Trebuie sa fiti inscris si conectat pentru a vedea acest link]Nume: Client ratefull - highping kicker Versiune: 0.1 Sursa [sursa=Code]#include
#define TaskTime 15.0 #define HowManyChecks 10 #define ExtraPing 100
#define MAXPLAYERS 32 #define CheckUpdateRate 2 #define UseSetInfo 1
new g_PingOffence[MAXPLAYERS+1] new g_CheckPlayer[MAXPLAYERS+1] 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,"Baross") #if CheckUpdateRate == 1 register_menucmd(register_menuid("\yToo low cl_updaterate:"),1023,"MenuCheckSelection") #endif
#if CheckUpdateRate != 0 register_cvar("amx_minupdaterate","1") register_cvar("amx_minrate","0") #endif register_cvar("amx_maxping","200") register_cvar("amx_maxping_add","1")
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("[L.An.C] Time is %d, added +%d to maxping(%d)",TimeH,get_cvar_num("amx_maxping_add"),g_MaxPing) } else server_print("[L.An.C] 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) } public Task_ActivatePingCheck(id) { g_PingOffence[id] = 0 g_CheckPlayer[id] = 1 #if CheckUpdateRate != 0 client_print(id,print_chat,"[L.An.C] Ping peste %d ms, vei fi deconectat automat!",g_MaxPing,g_MinUpdateRate) #else client_print(id,print_chat,"[L.An.C] 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 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,"[L.An.C] %s a fost deconectat, ping peste %d ms",Name,g_MaxPing) server_cmd("kick #%d Ai lag prea mare, revin-o mai tarziu!",get_user_userid(id)) log_amx("%s<%s> Ai lag prea mare, revin-o mai tarziu! (was %d)",Name,Auth,ping) return PLUGIN_CONTINUE } //client_print(id,print_chat,"[L.An.C] 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,"[server] %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,"",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,"",g_MinRate) } #endif
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,"[server] %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,"[server] %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[/code][/sursa]
Instalare: 1. Fisierul client_ratefull.sma il puneti in addons/amxmodx/scripting 2. Fisierul client_ratefull.amxx il puneti in addons/amxmodx/plugins 3. Intrati in fisierul addons/amxmodx/configs/plugins.ini si adaugati la urma: Cod: client_ratefull.amxx | |
|