All pastes #464015 Raw Edit

Something

public text v1 · immutable
#464015 ·published 2007-04-29 08:18 UTC
rendered paste body
#include <a_samp>
#include <dprops>
 
#define VERSION    "1.0.3"
 
public OnFilterScriptInit(){
        print("\n----------------------------------------------");
        printf("S:Anti-Flood %s by Sacky (+ Betamaster mod)", VERSION);
        print("----------------------------------------------");
}
 
new gPlayerAntiFlood[MAX_PLAYERS][2];
 
public OnPlayerConnect(playerid) {
	if(!PropertyExists("SB_AntiFlood_Timer")){
		PropertySet("SB_AntiFlood_Timer","Active");
		SetTimer("AFTimer", 1000, true);
	}
	gPlayerAntiFlood[playerid][0] = 0;
	if(gPlayerAntiFlood[playerid][1] > 10) {
		gPlayerAntiFlood[playerid][1] = 0;
		Ban(playerid);
		new playername[MAX_PLAYER_NAME];
		GetPlayerName(playerid, playername, MAX_PLAYER_NAME);
		new tmpstr[128];
		format(tmpstr, 128, "[S:Anti-Flood] Banned: %s for flood hack.", playername);
		print(tmpstr);
		SendClientMessageToAll(0xAA3333AA, tmpstr);
        }
        return 1;
}
 
public OnPlayerDisconnect(playerid) {
	if(gPlayerAntiFlood[playerid][0] < 3) {
		gPlayerAntiFlood[playerid][1]++;
	} else {
		gPlayerAntiFlood[playerid][1] = 0;
	}
	return 1;
}
 
public AFTimer(){
	static count = 0;
	count++, count %= 60;
	for(new i = 0; i < MAX_PLAYERS; i++) {
		if(IsPlayerConnected(i)) {
			if(count == 0) {
				gPlayerAntiFlood[i][0] = gPlayerAntiFlood[i][1] = 0;
			} else {
				gPlayerAntiFlood[i][0]++;
			}
		}
	}
}