04.05.2012, 14:20
Представляю вам простую защиту:
forward dos();
enum pInfo
{
pDos
}
new PlayerInfo[MAX_PLAYERS][pInfo];
В public OnGameModeInit() вставляем
SetTimer("dos",1000,1);
В public OnPlayerCommandText(playerid, cmdtext[]) вставляем:
PlayerInfo[playerid][pDos] += 1;
public dos()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[i][pDos] >= 6)
{
SendClientMessage(i, 0xFF0000AA, "Вы забанены за флуд.");
new ip[200];
GetPlayerIp(i,ip,sizeof(ip));
strdel(ip,strlen(ip),strlen(ip));
format(ip,128,"banip %s",ip);
SendRconCommand(ip);
}
else
{
PlayerInfo[i][pDos] = 0;
}
}
}
}
forward dos();
enum pInfo
{
pDos
}
new PlayerInfo[MAX_PLAYERS][pInfo];
В public OnGameModeInit() вставляем
SetTimer("dos",1000,1);
В public OnPlayerCommandText(playerid, cmdtext[]) вставляем:
PlayerInfo[playerid][pDos] += 1;
public dos()
{
for (new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[i][pDos] >= 6)
{
SendClientMessage(i, 0xFF0000AA, "Вы забанены за флуд.");
new ip[200];
GetPlayerIp(i,ip,sizeof(ip));
strdel(ip,strlen(ip),strlen(ip));
format(ip,128,"banip %s",ip);
SendRconCommand(ip);
}
else
{
PlayerInfo[i][pDos] = 0;
}
}
}
}