К переменным.
PHP код:
new jf_ip [MAX_PLAYERS] [64];
new jf_count [MAX_PLAYERS];
в public OnIncomingConnection(playerid, ip_address[], port)
PHP код:
for (new i = 0; i != MAX_PLAYERS; i++)
{
if(!strcmp(jf_ip[i], ip_address,true))
{
jf_count[i]++;
if (jf_count[i] > 2)
{
new jf_ban [64];
BlockIpAddress(ip_address,60*1000*5);
format(jf_ban, sizeof(jf_ban), "banip %s", ip_address);
SendRconCommand(jf_ban);
strmid (jf_ip[i], "NONE", 0, strlen ("NONE"), 5);
}
break;
}
else
{
strmid (jf_ip[i], ip_address, 0, strlen (ip_address), 32);
break;
}
}
в public OnGameModeInit()
PHP код:
for (new i = 0; i != MAX_PLAYERS; i++)
{
strmid ( jf_ip[i], "NONE", 0, strlen ("NONE"), 5);
jf_count[i] = 0;
}
SetTimer("JF_TIMER", 5*1000, true);
В конец мода
PHP код:
forward JF_TIMER();
public JF_TIMER()
{
for (new i = 0; i != MAX_PLAYERS; i++)
{
if(strcmp(jf_ip[i], "NONE", true))
{
new jf_ban [64];
format(jf_ban, sizeof(jf_ban), "unbanip %s", jf_ip[i]);
SendRconCommand(jf_ban);
break;
}
strmid (jf_ip[i], "NONE", 0, strlen ("NONE"), 5);
}
return 1;
}