Why that plug-in doesn't ban on ip ?
PHP Code:
#include <amxmodx>
#define PLUGIN "Punish Hammmering"
#define VERSION "1.0"
#define AUTHOR "Alka"
#define MAX_ATTEMPTS 4 //ile razy mozna polaczyc sie w ciagu 1 rundy z serverem
#define MAX_IPS 100
new g_ips[MAX_IPS][32];
new g_attempts[33];
new g_last_ip;
new g_ban_time = 5; //na ile ban za prube nadmiernych polaczen [minuty]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR);
register_logevent("round_start", 2, "1=Round_Start");
}
public client_connect(id)
{
new PlayersLimit = get_maxplayers();
new PlayersNum = get_playersnum(1);
if(PlayersNum >= PlayersLimit)
{
new UserIp[32];
get_user_ip(id, UserIp, 31, 1);
for(new i = 1 ; i <= g_last_ip ; i++)
{
if(equali(g_ips[i], UserIp))
{
g_attempts[i] += 1;
if(g_attempts[i] >= MAX_ATTEMPTS)
{
server_cmd("amx_banip %d %i;kick #%d Polaczyles sie wiecej niz %i razy [Hammmering]! Ban na %i minut.", g_ban_time, get_user_userid(id), get_user_userid(id), MAX_ATTEMPTS, g_ban_time);
g_attempts[i] = 0;
}
}
}
if(g_last_ip >= MAX_IPS)
return 0;
g_last_ip += 1;
copy(g_ips[g_last_ip], 31, UserIp);
g_attempts[g_last_ip] = 1;
}
return 0;
}
public round_start()
g_last_ip = 0;
__________________