////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////
//Kamiqawa Library V. 1.02 - By Kamiqawa//
//////////////////////////////////////////
//Installation:
//Name this file as es_kamiqawa_lib.txt
//Add this file (es_kamiqawa_lib.txt) inside cstrike/addons/eventscripts/kamiqawa_lib (create kamiqawa_lib folder if you don't already have it)
//Then add command es_load kamiqawa_lib to your autoexec.cfg inside cstrike/cfg.
//
//Installation instructions, latest version, help and more about this addon here:
//	http://warcraft-source.com/board/index.php/topic,13002.0.html
//////////////////////////////////////////
//Changelog:
//3.4.2011 	- Kamiqawa Lib published. Version 1.00.
//			+ Blend block added.
//4.4.2011 	- Added simple blend (duckblend) to replace old bugging blend.
//			+ Added Rocketeer ultimate: Freeze-Charge.
//			+ Added Rocketeer events: No fall damage and Rocket Jump.
//5.4.2011	- Replaced the old blend block with new simple one. It's not so effective and unique as it used to be, but now it works much better.
//////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




//////////////////////
////////BLOCKS////////
//////////////////////
//ES_LOAD KAMIQAWA_LIB
block load
{
es repeat create duckblend "es_xdoblock kamiqawa_lib/blendsimple"; es repeat start duckblend 1
es_msg #multi #defaultKamiqawa Library v.1.02 #lightgreenloaded!
}

//BLOCK FOR SKILL: BLEND 
block blendsimple
{	
		es wcs_foreach player wcs_targetid #all,#alive "es_xset wcs_tmp 0; es wcsgroup get duckblend wcs_tmp server_var(wcs_targetid); if (server_var(wcs_tmp) > 0) then wcs_xalias wcs_duckblend1"
		wcs_xalias wcs_duckblend1 "es_xset wcs_duck 0; es_getplayerprop wcs_duck server_var(wcs_targetid) CBasePlayer.localdata.m_Local.m_bDucked; wcs_xalias wcs_duckblend2; if (server_var(wcs_duck) = 0) then es wcs_setfx invisp server_var(wcs_targetid) = 0 0; if (server_var(wcs_duck) = 0) then es_xset blendstatus 0; if (server_var(wcs_duck) > 0) then es wcs_setfx invisp server_var(wcs_targetid) = 70 0; if (server_var(wcs_duck) > 0) then es_xset blendstatus 1"
		wcs_xalias wcs_duckblend2 "if (server_var(wcs_duck) > 0) then es_xif (server_var(blendstatus) = 0) then es_centertell server_var(wcs_targetid) Blend: You are now 70% invisible; if (server_var(wcs_duck) = 0) then es_xif (server_var(blendstatus) = 1) then es_centertell server_var(wcs_targetid) Blend: You are no longer invisible"
}


//BLOCK FOR ULTIMATE: FREEZE-CHARGE
block wcs_ulti_freezecharge
{	
	es_set userid server_var(wcs_userid)
	es_xset vector1 0
	es_xset wcs_x1 0
	es_xset wcs_y1 0
	es_xset wcs_z1 0
	if (server_var(wcs_power) = 0) then es_xset wcs_power 1.5
		wcs_xalias wcs_ulti_freezecharge1 "es playerget viewcoord server_var(userid) wcs_x1 wcs_y1 wcs_z1; es_createvectorstring vector1 server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1); es wcs pushto server_var(userid) server_var(vector1) server_var(wcs_power)"
	es wcs_setfx freeze server_var(userid) = 1 server_var(wcs_freeze)
	es_delayed server_var(wcs_freeze) wcs_xalias wcs_ulti_freezecharge1
}




//////////////////////
////////EVENTS////////
//////////////////////

event player_falldamage
{
	//NO FALL DAMAGE
	es_xset nofalldmg_flag 0
	es wcsgroup get nofalldmg nofalldmg_flag event_var(userid)
	if (server_var(nofalldmg_flag) > 0) do
	{
			es wcs_setfx health event_var(userid) + event_var(damage) 0
	}
}

event player_jump
{	
	//ROCKET JUMP
	es_xset rocketjump_flag 0
	es wcsgroup get rocketjump rocketjump_flag event_var(userid)
	if (server_var(rocketjump_flag) > 0) do
	{	
		es wcs push event_var(userid) 0 0 500
		es_getplayerlocation wcs_x1 wcs_y1 wcs_z1 event_var(userid)
		es est_effect 7 #a 0 sprites/smoke.vmt server_var(wcs_x1) server_var(wcs_y1) server_var(wcs_z1) 100 1
		es_playsound event_var(userid) weapons/grenade_launcher1.wav 0.2
	}
}



