- #include <amxmodx> 
- #include <hamsandwich> 
- #include <fakemeta> 
-   
- #define PLUGIN "Anti Behind" 
- #define VERSION "1.1" 
- #define AUTHOR "Bobs" 
-   
- #define fm_get_user_team(%1) get_pdata_int(%1, FM_OFFSET_TEAM) 
- #define FM_OFFSET_TEAM 114 
-   
- #define BACKSTAB_ANGLE 93.0 	//Changeable 
- #define BACKSTAB_MAX_DAMAGE 0.0 //Changeable 
-   
- #define FFADE_IN	 0x0000 
- #define FFADE_OUT	 0x0001 
-   
- new gmsgScreenFade; 
- new gMaxPlayers; 
- new bool:gBackStabing[33]; 
- new cvar_slap; 
-   
-   
- public plugin_init()   
- { 
- 	register_plugin(PLUGIN, VERSION, AUTHOR); 
-   
- 	register_forward(FM_CmdStart, "Fwd_CmdStart"); 
-   
- 	cvar_slap = register_cvar("ab_slap", "1"); 
-   
- 	RegisterHam(Ham_TakeDamage, "player", "Event_TakeDamage"); 
-   
- 	gMaxPlayers = global_get(glb_maxClients); 
-   
- 	gmsgScreenFade = get_user_msgid("ScreenFade"); 
- } 
-   
- public Fwd_CmdStart(id, uc_handle, uc_seed) 
- { 
- 	if(!is_user_alive(id)) 
- 		return FMRES_IGNORED; 
-   
- 	static Float:fViewAngles[3], iButton, iTemp; 
- 	get_uc(uc_handle, UC_ViewAngles, fViewAngles); 
- 	iButton = get_uc(uc_handle, UC_Buttons); 
-   
- 	if(((iButton & IN_ATTACK) || (iButton & IN_ATTACK2)) && get_user_weapon(id, iTemp, iTemp) == CSW_KNIFE) 
- 	{ 
- 		static iEnt, Float:fOrigin[3]; 
- 		pev(id, pev_origin, fOrigin); 
-   
- 		iEnt = fm_trace_target(id, fOrigin, 100); 
-   
- 		if(!(1 <= iEnt <= gMaxPlayers)) 
- 			return FMRES_IGNORED; 
-   
- 		static Float:fTViewAngles[3]; 
- 		pev(iEnt, pev_v_angle, fTViewAngles); 
-   
- 		static Float:fMinAngle, Float:fMaxAngle; 
- 		fMinAngle = fViewAngles[1] - BACKSTAB_ANGLE; 
- 		fMaxAngle = fViewAngles[1] + BACKSTAB_ANGLE; 
-   
- 		if(fMinAngle <= fTViewAngles[1] <= fMaxAngle) 
- 		{ 
- 			gBackStabing[id] = true; 
- 		} 
- 		else 
- 		{ 
- 			gBackStabing[id] = false; 
- 		} 
- 	} 
- 	return FMRES_IGNORED; 
- } 
-   
- public Event_TakeDamage(this, inflictor, attacker, Float:damage, dmgbits) 
- { 
- 	if(inflictor == 0) 
- 		return HAM_IGNORED; 
-   
- 	if(!is_user_alive(attacker) || !gBackStabing[attacker] || (fm_get_user_team(this) == fm_get_user_team(attacker))) 
- 		return HAM_IGNORED; 
-   
- 	if(damage > BACKSTAB_MAX_DAMAGE) 
- 	{ 
- 		SetHamParamFloat(4, BACKSTAB_MAX_DAMAGE); 
- 		set_task(0.1, "FadeScreenAttacker", attacker); 
- 		set_task(0.1, "FadeScreenVictim", this); 
- 	} 
- 	return HAM_HANDLED; 
- } 
-   
- stock fm_trace_target(ignoreent, const Float:start[3], distance) 
- { 
- 	new Float:fAim[3], Float:end[3]; 
- 	velocity_by_aim(ignoreent, distance, fAim); 
-   
- 	end[0] = start[0] + fAim[0]; 
- 	end[1] = start[1] + fAim[1]; 
- 	end[2] = start[2] + fAim[2]; 
-   
- 	engfunc(EngFunc_TraceLine, start, end, ignoreent == -1 ? 1 : 0, ignoreent, 0); 
-   
- 	new ent = get_tr2(0, TR_pHit); 
-   
- 	return pev_valid(ent) ? ent : 0; 
- } 
-   
- public FadeScreenAttacker(idattacker) 
- { 
- 	if(!is_user_connected(idattacker)) 
- 	{ 
- 		return PLUGIN_HANDLED; 
- 	} 
-   
- 	if(get_pcvar_num(cvar_slap)) 
- 	{ 
- 		user_slap(idattacker, 0); 
- 		user_slap(idattacker, 0); 
- 		user_slap(idattacker, 0); 
- 	} 
-   
- 	message_begin(MSG_ONE, gmsgScreenFade, {0,0,0}, idattacker); 
- 	write_short(2000); // Timer ex: 1000 = 1 sec 
- 	write_short(2000); // Timer ex: 1000 = 1 sec 
- 	write_short(FFADE_IN); 
- 	write_byte(139); // Red 
- 	write_byte(26); // Green 
- 	write_byte(26); // Blue 
- 	write_byte(255); // Transperency 
- 	message_end(); 
-   
- 	return PLUGIN_HANDLED; 
- } 
-   
- public FadeScreenVictim(id) 
- { 
- 	if(!is_user_connected(id)) 
- 	{ 
- 		return PLUGIN_HANDLED; 
- 	} 
-   
- 	message_begin(MSG_ONE, gmsgScreenFade, {0,0,0}, id); 
- 	write_short(600); // Timer ex: 1000 = 1 sec 
- 	write_short(600); // Timer ex: 1000 = 1 sec 
- 	write_short(FFADE_IN); 
- 	write_byte(20); // Red 
- 	write_byte(20); // Green 
- 	write_byte(255); // Blue 
- 	write_byte(175); // Transperency 
- 	message_end(); 
-   
- 	return PLUGIN_HANDLED 
- } 
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE 
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1030\\ f0\\ fs16 \n\\ par } 
- */ 
-