Public feed
#379680
#include <a_samp>
#include <dini>
#include <dprops>
#define VERSION "1.0"
public OnFilterScriptInit(){
print("\n-------------------------------------------------\n");
printf(" S:Anti-Flood %s by Sacky\n",VERSION);
print("-------------------------------------------------");
}
new connect[MAX_PLAYERS];
new hack;
new names[MAX_PLAYERS][MAX_PLAYER_NAME];
public OnPlayerConnect(playerid){
if(!PropertyExists("Timer")){
PropertySet("Timer","On");
SetTimer("SecTimer",1000,true);
SetTimer("ClearHack",60000,true);
}
GetPlayerName(playerid,names[playerid],MAX_PLAYER_NAME);
connect[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid){
if(connect[playerid] < 5){
new playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
new p;
for(new i=0;i<MAX_PLAYERS;i++){
if(equal(playername,names[i],false)) break;
p++;
}
if(p == MAX_PLAYERS) hack++;
if(hack > 5){
hack = 0;
Ban(playerid);
printf("Banned: %s for flood hack",playername);
}
}
return 1;
}
public SecTimer() for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i)) connect[i]++;
public ClearHack() hack = 0;