All pastes #446077 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-04-18 08:34 UTC
rendered paste body
#include <a_samp>
#include <dini>
#include <dprops>

#define VERSION "1.0.2"

public OnFilterScriptInit(){
	print("\n-------------------------------------------------\n");
	printf("	S:Anti-Flood %s by Sacky\n",VERSION);
	print("-------------------------------------------------");
}

new connect[MAX_PLAYERS];
new hack;

public OnPlayerConnect(playerid){
	if(!PropertyExists("Timer")){
		PropertySet("Timer","On");
		SetTimer("SecTimer",1000,true);
		SetTimer("ClearHack",60000,true);
	}
	connect[playerid] = 0;
	return 1;
}

public OnPlayerDisconnect(playerid){
	if(connect[playerid] < 3){
		hack++;
		if(hack > 5){
			hack = 0;
			Ban(playerid);
			new playername[MAX_PLAYER_NAME];
			GetPlayerName(playerid,playername,sizeof(playername));
			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;
}