/***********************************************************
	Damage Effects
	Author: TaRgEt*TuRkEy - Vaughn Royko
	Version: 1.0.0
	Mod: Half-Life Deathmatch (Valve)
	Requires: AMX Mod X v1.0 
	Description: 
		Adds extra effects when you take damage. Your screen
		will flash red, simulating blood and also shake. Both 
		of these can be enabled and disabled through cvars.
		
	Cvars: 	
		amx_redflash 	<0 or 1>
		amx_shake 	<0 or 1>
		
***********************************************************/

#include 
#include 
#include 
#include 

new Title[32] = "Damage Effects"
new Version[32] = "1.0.0"
new Author[16] = "TaRgEt*TuRkEy"

public plugin_init()
	{
	register_plugin(Title,Version,Author)
	register_event("Damage", "got_hit", "b", "2!0", "3=0", "4!0")
	register_cvar("amx_redflash","1")
	register_cvar("amx_shake","1")
	return PLUGIN_HANDLED
}

public got_hit(id)
	{
	if(is_user_connected(id)) {
			if(get_cvar_num("amx_redflash")) {
				message_begin(MSG_ONE,get_user_msgid("ScreenFade"),{0,0,0},id)
				write_short(25)
				write_short(25)
				write_short(9)
				write_byte(255)
				write_byte(0)
				write_byte(0)
				write_byte(200)
				message_end()
			}
			if(get_cvar_num("amx_shake")) {
				message_begin(MSG_ONE,get_user_msgid("ScreenShake"),{0,0,0},id)
				write_short(255<< 14 ) //ammount 
				write_short(2500) //lasts this long 
				write_short(255<< 14) //frequency 
				message_end() 
			}
	}
	return PLUGIN_HANDLED
}