// PUNISHER! - Unlimited Ammo

/* CVARS - copy and paste to shconfig.cfg

//Punisher
punisher_level 0
punisher_dropwpn 0		//Should clinet be forced to drop thier weapon?

*/

#include <amxmod>
#include <superheromod>

// GLOBAL VARIABLES
new gHeroName[]="Punisher"
new bool:gHasPunisherPowers[SH_MAXSLOTS+1]

//----------------------------------------------------------------------------------------------
public plugin_init()
{
	// Plugin Info
	register_plugin("SUPERHERO Punisher","1.18","{HOJ} Batman")

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

	// FIRE THE EVENT TO CREATE THIS SUPERHERO!
	shCreateHero(gHeroName, "Unlimited Ammo", "Endless Bullets. No Reload! Keep Shooting", false, "punisher_level" )

	// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
	register_srvcmd("punisher_init", "punisher_init")
	shRegHeroInit(gHeroName, "punisher_init")

	// Punisher Test
	register_event("CurWeapon","changeWeapon","be","1=1")

}
//----------------------------------------------------------------------------------------------
public punisher_init()
{
	// First Argument is an id
	new temp[6]
	read_argv(1,temp,5)
	new id=str_to_num(temp)

	// 2nd Argument is 0 or 1 depending on whether the id has wolverine skills
	read_argv(2,temp,5)
	new hasPowers=str_to_num(temp)

	gHasPunisherPowers[id] = (hasPowers!=0)
}
//----------------------------------------------------------------------------------------------
public changeWeapon(id)
{
	if ( !gHasPunisherPowers[id] || !shModActive() ) return

	new wpnid = read_data(2)
	new clip = read_data(3)

	if ( wpnid == CSW_C4 || wpnid == CSW_KNIFE ) return
	if ( wpnid == CSW_HEGRENADE || wpnid == CSW_SMOKEGRENADE || wpnid == CSW_FLASHBANG) return

	if ( clip == 0 ) {
		shReloadAmmo(id, get_cvar_num("punisher_dropwpn"))
	}
}
//----------------------------------------------------------------------------------------------