[FilterScript] DeadKill
#1

DeadKill by iToast

DeadKill was wrote augest 16 2012

DeadKill prevents common attacks like fake kill some cheats and rcon brute forcing. Unfortunately it has not and will NEVER be completed

It is fully functional and you may reuse its source for anything as long as you provide credits to me, the original author in your credits!

Script:

Code:
#include <a_samp>
#include <colours>

//For Efficency
#undef MAX_PLAYERS
#define MAX_PLAYERS 20

//Forwards
forward HackCheck();

//Script Settings
#define MAX_CHEAT_BAN true // Ban if max cheat warnings reached!
#define USE_IP_BAN true // Bans the players ip aswell!
#define MAX_PING 300 // Max Player Ping
#define MAX_KDIST 70 // Max Player Kill Distance
#define MAX_CHEATW 5 // Max Player Cheat Warnings
#define MAX_FAILED_RCON 3 // Max Rcon Failures
#define CHECK_DELAY 180000 // Time before players are checked for hacks.

//Script Variables
new CHEAT_WARNINGS[MAX_PLAYERS] = 0;
new RCON_FAIL[MAX_PLAYERS] = 0;
new DEAD[MAX_PLAYERS] = false;

//Check Cheat Warnings
stock CheckWarnings(playerid)
{
	if(CHEAT_WARNINGS[playerid] >= MAX_CHEATW && MAX_CHEAT_BAN && USE_IP_BAN)
	{
	    new name[MAX_PLAYER_NAME], str[256];
	    GetPlayerName(playerid, name, sizeof(name));
	    format(str, 256, "%s has been IP BANNED for getting too many cheat warnigns!", name);
	    print(str);
     	new ip[24], bstr[128];
	    GetPlayerIp(playerid, ip, 24);
		format(bstr, 128, "banip %s", ip);
		SendRconCommand(bstr);
	}else{
 		new name[MAX_PLAYER_NAME], str[256];
	    GetPlayerName(playerid, name, sizeof(name));
	    format(str, 256, "%s has been BANNED for getting too many cheat warnigns!", name);
	    print(str);
	}
}

//Check Rcon Failures
stock CheckRconFail(playerid)
{
	if(RCON_FAIL[playerid] >= MAX_FAILED_RCON && USE_IP_BAN)
	{
	    new name[MAX_PLAYER_NAME], str[256];
	    GetPlayerName(playerid, name, sizeof(name));
	    format(str, 256, "%s has been IP BANNED for too many failed rcon attempts!", name);
	    print(str);
     	new ip[24], bstr[128];
	    GetPlayerIp(playerid, ip, 24);
		format(bstr, 128, "banip %s", ip);
		Ban(playerid);
		SendRconCommand(bstr);
	}else{
 		new name[MAX_PLAYER_NAME], str[256];
	    GetPlayerName(playerid, name, sizeof(name));
	    format(str, 256, "%s has been BANNED for too many failed rcon attempts!", name);
	    print(str);
		Ban(playerid);
	}
}

public OnFilterScriptInit()
{
	print("DeadKill by iToasterman");
	SetTimer("HackCheck", CHECK_DELAY, true);
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	CHEAT_WARNINGS[playerid] = 0;
	RCON_FAIL[playerid] = 0;
	DEAD[playerid] = false;
	return 1;
}

public OnPlayerSpawn(playerid)
{
	DEAD[playerid] = false;
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	// Deal with Fake Kill
	new Float:vx, Float:vy, Float:vz;
	GetPlayerPos(playerid, vx, vy, vz);
	
	if(!IsPlayerInRangeOfPoint(killerid, MAX_KDIST, vx, vy, vz))
	{
	    CHEAT_WARNINGS[killerid]++;
	    CheckWarnings(killerid);
	}
	
	DEAD[playerid] = true;
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	if(success == 0)
	{
	    new tip[24];
	    for(new i = 0; i < MAX_PLAYERS; i++)
	    {
			GetPlayerIp(i, tip, 24);
			if(!strcmp(ip, tip, true))
			{
				RCON_FAIL[i]++;
				CheckRconFail(i);
			}
	    
	    }
	}
	return 1;
}

public HackCheck()
{
	new Float:HP, Float:HP2;
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
	    GetPlayerHealth(i, HP);
	    SetPlayerHealth(i, HP -1);
	    GetPlayerHealth(i, HP);
	}
	
	for(new j = 0; j < MAX_PLAYERS; j++)
	{
		GetPlayerHealth(j, HP2);
		if(HP2 != HP)
		{
		    SetPlayerHealth(j, HP + 1);
			CHEAT_WARNINGS[j]++;
			CheckWarnings(j);
		}
	}
}
Colours.inc

Code:
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_LIME 0x10F441AA
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_NAVY 0x000080AA
#define COLOR_AQUA 0xF0F8FFAA
#define COLOR_CRIMSON 0xDC143CAA
#define COLOR_FLBLUE 0x6495EDAA
#define COLOR_BISQUE 0xFFE4C4AA
#define COLOR_BLACK 0x000000AA
#define COLOR_CHARTREUSE 0x7FFF00AA
#define COLOR_BROWN 0XA52A2AAA
#define COLOR_CORAL 0xFF7F50AA
#define COLOR_GOLD 0xB8860BAA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_LAWNGREEN 0x7CFC00AA
#define COLOR_SEAGREEN 0x20B2AAAA
#define COLOR_LIMEGREEN 0x32CD32AA //<--- Dark lime
#define COLOR_MIDNIGHTBLUE 0X191970AA
#define COLOR_MAROON 0x800000AA
#define COLOR_OLIVE 0x808000AA
#define COLOR_ORANGERED 0xFF4500AA
#define COLOR_PINK 0xFFC0CBAA // - Light light pink
//#define COLOR_SEAGREEN 0x2E8B57AA
#define COLOR_SPRINGGREEN 0x00FF7FAA
#define COLOR_TOMATO 0xFF6347AA // - Tomato >:/ sounds wrong lol... well... :P
#define COLOR_YELLOWGREEN 0x9ACD32AA //- like military green
#define COLOR_MEDIUMAQUA 0x83BFBFAA
#define COLOR_MEDIUMMAGENTA 0x8B008BAA // dark magenta ^^
#define COLOR_GRAD1 0xB4B5B7FF
#define COLOR_GRAD2 0xBFC0C2FF
#define COLOR_GRAD3 0xCBCCCEFF
#define COLOR_GRAD4 0xD8D8D8FF
#define COLOR_GRAD5 0xE3E3E3FF
#define COLOR_GRAD6 0xF0F0F0FF
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_FADE1 0xE6E6E6E6
#define COLOR_FADE2 0xC8C8C8C8
#define COLOR_FADE3 0xAAAAAAAA
#define COLOR_FADE4 0x8C8C8C8C
#define COLOR_FADE5 0x6E6E6E6E
#define COLOR_DBLUE 0x2641FEAA
#define COLOR_ALLDEPT 0xFF8282AA
#define OBJECTIVE_COLOR 0x64000064
#define TEAM_GREEN_COLOR 0xFFFFFFAA
#define TEAM_BLUE_COLOR 0x8D8DFFAA
#define COLOR_ADD 0x63FF60AA
#define TEAM_CYAN_COLOR 0xFF8282AA
#define TEAM_ORANGE_COLOR 0xFF8300C8
#define TEAM_ORANGE1_COLOR 0xFF830099
#define TEAM_ORANGE2_COLOR 0xFF830088
#define TEAM_ORANGE3_COLOR 0xFF830077
#define TEAM_ORANGE4_COLOR 0xFF830066
#define TEAM_ORANGE5_COLOR 0xFF830055
#define TEAM_ORANGE6_COLOR 0xFF830044
#define TEAM_ORANGE7_COLOR 0xFF830033
#define TEAM_ORANGE8_COLOR 0xFF830022
#define TEAM_ORANGE9_COLOR 0xFF830011
#define TEAM_ORANGE10_COLOR 0xFF830000
#define TEAM_BALLAS_COLOR 0xD900D3C8
#define TEAM_BALLAS1_COLOR 0xD900D399
#define TEAM_BALLAS2_COLOR 0xD900D388
#define TEAM_BALLAS3_COLOR 0xD900D377
#define TEAM_BALLAS4_COLOR 0xD900D366
#define TEAM_BALLAS5_COLOR 0xD900D355
#define TEAM_BALLAS6_COLOR 0xD900D344
#define TEAM_BALLAS7_COLOR 0xD900D333
#define TEAM_BALLAS8_COLOR 0xD900D322
#define TEAM_BALLAS9_COLOR 0xD900D311
#define TEAM_BALLAS10_COLOR 0xD900D300
#define TEAM_GROVE_COLOR 0x00D900C8
#define TEAM_GROVE1_COLOR 0x00D90099
#define TEAM_GROVE2_COLOR 0x00D90088
#define TEAM_GROVE3_COLOR 0x00D90077
#define TEAM_GROVE4_COLOR 0x00D90066
#define TEAM_GROVE5_COLOR 0x00D90055
#define TEAM_GROVE6_COLOR 0x00D90044
#define TEAM_GROVE7_COLOR 0x00D90033
#define TEAM_GROVE8_COLOR 0x00D90022
#define TEAM_GROVE9_COLOR 0x00D90011
#define TEAM_GROVE10_COLOR 0x00D90000
#define TEAM_VAGOS_COLOR 0xFFC801C8
#define TEAM_VAGOS1_COLOR 0xFFC80199
#define TEAM_VAGOS2_COLOR 0xFFC80188
#define TEAM_VAGOS3_COLOR 0xFFC80177
#define TEAM_VAGOS4_COLOR 0xFFC80166
#define TEAM_VAGOS5_COLOR 0xFFC80155
#define TEAM_VAGOS6_COLOR 0xFFC80144
#define TEAM_VAGOS7_COLOR 0xFFC80133
#define TEAM_VAGOS8_COLOR 0xFFC80122
#define TEAM_VAGOS9_COLOR 0xFFC80111
#define TEAM_VAGOS10_COLOR 0xFFC80100
#define TEAM_AZTECAS_COLOR 0x01FCFFC8
#define TEAM_AZTECAS1_COLOR 0x01FCFF99
#define TEAM_AZTECAS2_COLOR 0x01FCFF88
#define TEAM_AZTECAS3_COLOR 0x01FCFF77
#define TEAM_AZTECAS4_COLOR 0x01FCFF66
#define TEAM_AZTECAS5_COLOR 0x01FCFF55
#define TEAM_AZTECAS6_COLOR 0x01FCFF44
#define TEAM_AZTECAS7_COLOR 0x01FCFF33
#define TEAM_AZTECAS8_COLOR 0x01FCFF22
#define TEAM_AZTECAS9_COLOR 0x01FCFF11
#define TEAM_AZTECAS10_COLOR 0x01FCFF00
#define TEAM_NANG_COLOR 0xBDCB92C8
#define TEAM_NANG1_COLOR 0xBDCB9299
#define TEAM_NANG2_COLOR 0xBDCB9288
#define TEAM_NANG3_COLOR 0xBDCB9277
#define TEAM_NANG4_COLOR 0xBDCB9266
#define TEAM_NANG5_COLOR 0xBDCB9255
#define TEAM_NANG6_COLOR 0xBDCB9244
#define TEAM_NANG7_COLOR 0xBDCB9233
#define TEAM_NANG8_COLOR 0xBDCB9222
#define TEAM_NANG9_COLOR 0xBDCB9211
#define TEAM_NANG10_COLOR 0xBDCB9200
#define TEAM_RIFA_COLOR 0x000000C8
#define TEAM_RIFA1_COLOR 0x00000099
#define TEAM_RIFA2_COLOR 0x00000088
#define TEAM_RIFA3_COLOR 0x00000077
#define TEAM_RIFA4_COLOR 0x00000066
#define TEAM_RIFA5_COLOR 0x00000055
#define TEAM_RIFA6_COLOR 0x00000044
#define TEAM_RIFA7_COLOR 0x00000033
#define TEAM_RIFA8_COLOR 0x00000044
#define TEAM_RIFA9_COLOR 0x00000055
#define TEAM_RIFA10_COLOR 0x00000066
#define TEAM_MAFIA_COLOR 0x9A9999C8
#define TEAM_MAFIA1_COLOR 0x9A999999
#define TEAM_MAFIA2_COLOR 0x9A999988
#define TEAM_MAFIA3_COLOR 0x9A999977
#define TEAM_MAFIA4_COLOR 0x9A999966
#define TEAM_MAFIA5_COLOR 0x9A999955
#define TEAM_MAFIA6_COLOR 0x9A999944
#define TEAM_MAFIA7_COLOR 0x9A999933
#define TEAM_MAFIA8_COLOR 0x9A999922
#define TEAM_MAFIA9_COLOR 0x9A999911
#define TEAM_MAFIA10_COLOR 0x9A999900
#define TEAM_RMAFIA_COLOR 0x916600C8
#define TEAM_RMAFIA1_COLOR 0x91660099
#define TEAM_RMAFIA2_COLOR 0x91660088
#define TEAM_RMAFIA3_COLOR 0x91660077
#define TEAM_RMAFIA4_COLOR 0x91660066
#define TEAM_RMAFIA5_COLOR 0x91660055
#define TEAM_RMAFIA6_COLOR 0x91660044
#define TEAM_RMAFIA7_COLOR 0x91660033
#define TEAM_RMAFIA8_COLOR 0x91660022
#define TEAM_RMAFIA9_COLOR 0x91660011
#define TEAM_RMAFIA10_COLOR 0x91660000
#define TEAM_TRIADS_COLOR 0x587B95C8
#define TEAM_TRIADS1_COLOR 0x587B9599
#define TEAM_TRIADS2_COLOR 0x587B9588
#define TEAM_TRIADS3_COLOR 0x587B9577
#define TEAM_TRIADS4_COLOR 0x587B9566
#define TEAM_TRIADS5_COLOR 0x587B9555
#define TEAM_TRIADS6_COLOR 0x587B9544
#define TEAM_TRIADS7_COLOR 0x587B9533
#define TEAM_TRIADS8_COLOR 0x587B9522
#define TEAM_TRIADS9_COLOR 0x587B9511
#define TEAM_TRIADS10_COLOR 0x587B9500
#define TEAM_BIKERS_COLOR 0xA49A00C8
#define TEAM_BIKERS1_COLOR 0xA49A0099
#define TEAM_BIKERS2_COLOR 0xA49A0088
#define TEAM_BIKERS3_COLOR 0xA49A0077
#define TEAM_BIKERS4_COLOR 0xA49A0066
#define TEAM_BIKERS5_COLOR 0xA49A0055
#define TEAM_BIKERS6_COLOR 0xA49A0044
#define TEAM_BIKERS7_COLOR 0xA49A0033
#define TEAM_BIKERS8_COLOR 0xA49A0022
#define TEAM_BIKERS9_COLOR 0xA49A0011
#define TEAM_BIKERS10_COLOR 0xA49A0000
#define COLOR_INVIS 0xAFAFAF00
#define COLOR_SPEC 0xBFC0C200
#define COLOR_ADMIN_PW 0x99CCFFAA
#define COLOR_ADMIN_CMD 0xCC6666AA
#define COLOR_ADMIN_PM 0x6699CCAA
#define COLOUR_PERSONAL  0x8080FFAA
#define COLOUR_IMPORTANT 0xFF0000AA
#define COLOUR_GLOBAL	0xD0D0FFAA
#define COLOUR_BROADCAST 0x0066CCAA
#define COLOR_SYSTEM 0xEFEFF7AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_IVORY 0xFFFF82FF
#define COLOR_PURPLE 0x800080FF
#define COLOR_LIGHTGREEN 0x00FF7FFF
#define COLOR_VIOLET 0xEE82EEFF
#define COLOR_SILVER 0xC0C0C0FF
#define COLOR_FIREBRICK 0xB22222FF
#define COLOR_LIGHTYELLOW 0xFAFA02FF
#define COLOR_MAGENTA 0xFF00FFFF
#define COLOR_BRIGHTGREEN 0x7CFC00FF
#define COLOR_DARKBLUE 0x000080AFF
#define COLOR_VIOLETRED 0xDB7093FF
#define COLOR_GREENYELLOW 0xADFF2FFF
#define COLOR_THISTLE 0xD8BFD8FF
#define COLOR_TURQUISE 0x48D1CCFF
#define COLOR_STEELBLUE 0xB0C4DEFF
#define COLOR_PLAYER_LIGHTBLUE 0x9292FFDD
#define COLOR_PLAYER_BLUE 0x0000FFDD
#define COLOR_PLAYER_DARKBLUE 0x000096DD
#define COLOR_PLAYER_SPECIALBLUE 0x4169FFDD
#define COLOR_PLAYER_LIGHTRED 0xFFB0B0DD
#define COLOR_PLAYER_RED 0xFF0000DD
#define COLOR_PLAYER_DARKRED 0xA10000DD
#define COLOR_PLAYER_SPECIALRED 0xB22222DD
#define COLOR_PLAYER_LIGHTGREEN 0x92FF92DD
#define COLOR_PLAYER_GREEN 0x00FF00DD
#define COLOR_PLAYER_DARKGREEN 0x009600DD
#define COLOR_PLAYER_SPECIALGREEN 0x7ACA7ADD
#define COLOR_PLAYER_LIGHTYELLOW 0xFFFF5EDD
#define COLOR_PLAYER_YELLOW 0xFFFF00DD
#define COLOR_PLAYER_DARKYELLOW 0xD3D300DD
#define COLOR_PLAYER_SPECIALYELLOW 0xCFAE00DD
#define COLOR_PLAYER_LIGHTPURPLE 0xFF92FFDD
#define COLOR_PLAYER_PURPLE 0xFF00FFDD
#define COLOR_PLAYER_DARKPURPLE 0x800080DD
#define COLOR_PLAYER_SPECIALPURPLE 0xDA70D6DD
#define COLOR_PLAYER_LIGHTBROWN 0xBA9072DD
#define COLOR_PLAYER_BROWN 0x8B4513DD
#define COLOR_PLAYER_DARKBROWN 0x6D360EDD
#define COLOR_PLAYER_LIGHTGREY 0xC7C7C7DD
#define COLOR_PLAYER_GREY 0x8B8B8BDD
#define COLOR_PLAYER_DARKGREY 0x656565DD
#define COLOR_PLAYER_WHITE 0xFFFFFFDD
#define COLOR_PLAYER_BLACK 0x000000DD
#define COLOR_PLAYER_AQUAMARINE 0x7FFFD4DD
#define COLOR_PLAYER_CYAN 0x00FFFFDD
#define COLOR_GM_REG 0xFFFFFFAA		// WHITE (FFFFFF) normal chat to everyone (registered users)
#define COLOR_GM_UNREG 0xFF9999AA	// LIGHT RED(FF9999) normal chat to everyone (unregistered users)
#define COLOR_GM_ADMIN 0xFFCC66AA	// LIGHT ORANGE (FFCC66) normal chat to everyone (admins)
#define COLOR_IRC 0x66CCFFAA		// LIGHT BLUE (66CCFF) irc messages (/me /query (!) /slap)
#define COLOR_ADMINCHAT 0xFF9933AA	// BRIGHT ORANGE (FF9933) admin only chat (@)
#define COLOR_SYSTEM_PM 0x66CC00AA	// LIGHT GREEN (66CC00) system generated personal message (logged in, progress saved, function disabled)
#define COLOR_SYSTEM_GM 0xFF9966AA	// LIGHT ORANGE-RED (FF9966) system generated general message ("x just bought the four dragons!")
#define COLOR_SYSTEM_PW 0xFFFF33AA	// YELLOW (FFFF33) system personal warning ("you must be in a bank")
#define COLOR_SYSTEM_GW 0xCCCCCCAA	// GRAY (CCCCCC) system general warning ("x used a money cheat")
#define COLOR_MONEY_INC 0x00CC66AA	// GREEN (00CC66) money increase related system message ("you earned x money")
#define COLOR_MONEY_DEC 0xFF6600AA	// RED (FF6600) money decrease related system message ("your property has been bought out")
#define COLOR_MENU 0xFFFFFFAA		// WHITE (FFFFFF) menu's (/help)
#define COLOR_CMD 0xFFFFFFAA		// WHITE (FFFFFF)commands (Usage: ...)
#define COLOR_ADMIN_CMD 0xCC6666AA	// RED BROWN (CC6666) admin commands (Usage: ...)
#define COLOR_ADMIN_PM 0x6699CCAA	// GREEN BLUE (6699CC) admin personal message (your money has been set to X)
#define COLOR_ADMIN_PW 0x99CCFFAA	// BLUE (99CCFF) admin personal warning (x is not an active player)
#define COLOR_ADMIN_GM 0xFF6633AA	// LIGHT RED (FF6633) admin general message (was jailed by admin x)
#define COLOR_STATS 0xCCCCFFAA		// LIGHT  PURPLE (CCCCFF) stats (/stat /totalstat)
#define COLOR_MESSAGE 0xFFCCFFAA	// PURPLE (FFCCFF) Message system (anticheat, blog address)
#define COLOR_RULES 0xDC143CAA      // RED
#define COLOR_ADMIN_TOALL 0x00FFFFAA// CYAN
#define COLOR_GROUPTALK 0x87CEEBAA  // SKYBLUE
#define COLOR_ADMIN_REPORT 0xFF69B4AA // HOTPINK
#define COLOR_ADMIN_SPYREPORT 0xB0E0E6AA //POWDERBLUE
#define COLOR_ADMIN 0xFF8200FF
#define COLOR_CARDIVE 0xEE82EEAA //VIOLET
#define COLOR_BLACK_PD 0x000000FF
#define COLOR_WHITE_PD 0xFFFFFFFF
#define COLOR_DISARMING 0xEE82EEBB
Reply


Messages In This Thread
DeadKill - by iToast - 16.08.2012, 08:24

Forum Jump:


Users browsing this thread: 1 Guest(s)