Bonjour,
https://forums.alliedmods.net/showpo...8&postcount=41
Celui-ci, cette version ne marché pas avant qu'il la modifie. La version de connor n'est pas encore présente sur ce topic.Mais elle marche plutôt bien. Aucun mass kick pour le moment, enfin 1 seul mais c'est le plugins qui a kick tous le monde on a pas trouvé la raison
[EDIT] Le plugin:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
new const Plugin[] = "Bad Clients Handler"
new const Author[] = "joaquimandrade/Connor"
new const Version[] = "1.04"
new Float:LastCommandReceivedTime[33]
new IsConnected[33]
new MaxPlayers
new Float:ThinkDelay = 0.1
new CvarTimeout
new CvarTimeoutRoundStart
public plugin_init()
{
register_plugin(Plugin, Version, Author)
register_forward(FM_CmdStart, "cmdStart")
register_event("HLTV", "newRound", "a", "1=0", "2=0")
set_task(ThinkDelay, "handlerThink", .flags="b")
CvarTimeout = register_cvar("badclients_timeout", "5.0")
CvarTimeoutRoundStart = register_cvar("badclients_timeout_round", "3.0")
MaxPlayers = get_maxplayers()
}
public newRound()
{
checkBadClients(get_pcvar_float(CvarTimeoutRoundStart))
}
checkBadClients(Float:timeout)
{
static Float:gametime
gametime = get_gametime()
for(new i=1; i<= MaxPlayers; i++)
{
if( IsConnected[i] )
{
if( (gametime - LastCommandReceivedTime[i]) >= timeout)
{
forceDisconnect(i)
}
}
}
}
public handlerThink(id)
{
checkBadClients(get_pcvar_float(CvarTimeout))
}
forceDisconnect(id)
{
new name[32], steamID[21]
get_user_name(id, name, charsmax(name))
get_user_authid(id, steamID, charsmax(steamID))
log_to_file("badClientsHandler.txt", "Forcing disconnect of client ^"%s<%s>", name, steamID)
client_cmd(id, "reconnect") // if this is false/positive, try to reconnect player
server_cmd("kick #%d ^"Seems you are timeout, preventing multiple overflows/kicks^"", get_user_userid(id))
server_exec()
}
public client_putinserver(id)
{
IsConnected[id] = !is_user_bot(id) && !is_user_hltv(id)
LastCommandReceivedTime[id] = get_gametime() + 1.0
}
public client_disconnect(id)
{
if(IsConnected[id])
IsConnected[id] = false
}
public cmdStart(id,uc_handle,random_seed)
{
LastCommandReceivedTime[id] = get_gametime()
}