// Wind Walker!

/* CVARS - copy and paste to shconfig.cfg

//Windwalker
windwalker_level 0

*/

#include <amxmod>
#include <superheromod>

#if defined AMX_NEW
	#include <Vexd_Utilities>
#endif

#if defined AMX98
	#include <xtrafun>
#endif

// VARIABLES
new gHeroName[]="Wind Walker"
new gHasWindWalker[SH_MAXSLOTS+1]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
	register_plugin("SUPERHERO Wind Walker","1.18","AssKicR/JTP10181")

	// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
	register_cvar("windwalker_level", "0" )

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Silent Wind", "Enemy cannot hear your footsteps", false, "windwalker_level" )

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)

	//INIT
	register_srvcmd("windwalker_init", "windwalker_init")
	shRegHeroInit(gHeroName, "windwalker_init")

	#if !defined AMX_NEW
	// EVENTS
	register_event("ResetHUD","newRound","b")
	#endif

}
//----------------------------------------------------------------------------------------------
public windwalker_init()
{
	new temp[6]

	// First Argument is an id
	read_argv(1,temp,5)
	new id=str_to_num(temp)

	// 2nd Argument is 0 or 1 depending on whether the id has Wind Walker
	read_argv(2,temp,5)
	new hasPowers = str_to_num(temp)
	gHasWindWalker[id] = (hasPowers != 0)

#if defined AMX_NEW

}
//----------------------------------------------------------------------------------------------
public client_prethink(id)
{
	if(gHasWindWalker[id]) {
		Entvars_Set_Int(id, EV_INT_flTimeStepSound, 999)
	}
}

#else

	//Got to remove the powers if he is not Wind Walker
	if ( !hasPowers && is_user_connected(id) ) {
		set_user_footsteps(id,0)
	}

	//Give Powers to the Wind Walker
	if ( hasPowers && is_user_connected(id) ) {
		set_user_footsteps(id,1)
	}
}
//----------------------------------------------------------------------------------------------
public newRound(id)
{
	if ( gHasWindWalker[id] && is_user_connected(id)) {
		set_user_footsteps(id,1)
	}
}
//----------------------------------------------------------------------------------------------
#endif











