// VASH THE STAMPEDE! - From the anime Trigun. Vash is a peace loving, donut eating, girl crazy pacifist with a 60 billion double dollar bounty on his head.
/* CVARS - copy and paste to shconfig.cfg
//Vash the Stampede
vash_level 4
vash_deaglemult 2.5 //Damage multiplyer for his Deagle
vash_gravity 1.0 //Default 1.0 = normal gravity (0.50 is 50% of normal gravity, ect.)
*/
/*
* v1.4 - vittu - 6/22/05
* - Code clean up.
*
* v1.3 - vittu - 5/05/05
* - Fixed code run on clearpowers, now only gets run if user actually had the hero.
* - Other minor change to code for efficiency.
*
* v1.2 - vittu - 2/02/05
* - Changed weapon model, old one was for the wrong hand anyway.
* - Added Evasion to code, a missing hitzone randomly chosen every second.
* - Set gravity default to none because vash doesn't have low gravity, but
* left cvar since it was in orginal.
* - Removed no-reload because he uses a revolver, and gave ammo instead but
* just enough not affect no-reload heroes.
*
* Ripped from the hero - Morpheus by RadidEskimo & Freecode.
* Weapon model by Thin Red Paste & X-convinct, converted by SplinterCell.
*/
#include <amxmodx>
#include <superheromod>
#include <Vexd_Utilities>
// GLOBAL VARIABLES
new gHeroName[]="Vash the Stampede"
new bool:gHasVashPower[SH_MAXSLOTS+1]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Vash the Stampede", "1.4", "sharky / vittu")
register_dictionary("sh_vash.txt")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("vash_level", "4")
register_cvar("vash_deaglemult", "2.5")
register_cvar("vash_gravity", "1.0")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(gHeroName, "Revolver & Evasion", "Get Vash's .45 Long Colt Revolver (DEAGLE), that does More Damage. Also, evade by removing random hitzones.", false, "vash_level")
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
// INIT
register_srvcmd("vash_init", "vash_init")
shRegHeroInit(gHeroName, "vash_init")
// EVENTS
register_event("ResetHUD", "newSpawn", "b")
register_event("CurWeapon", "weaponChange", "be", "1=1")
register_event("Damage", "vash_damage", "b", "2!0")
// HITZONE CHANGING LOOP
set_task(1.0, "vash_hitzones", 0, "", 0, "b")
// Let Server know about Vash's Variables
shSetMinGravity(gHeroName, "vash_gravity")
}
//----------------------------------------------------------------------------------------------
public plugin_precache()
{
precache_model("models/shmod/vash_deagle.mdl")
}
//----------------------------------------------------------------------------------------------
public vash_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 the hero
read_argv(2,temp,5)
new hasPowers = str_to_num(temp)
if ( is_user_alive(id) ) {
if ( hasPowers ) {
vash_weapons(id)
switchmodel(id)
}
// This gets run if they had the power but don't anymore
else if ( !hasPowers && gHasVashPower[id] ){
engclient_cmd(id, "drop", "weapon_deagle")
shRemGravityPower(id)
set_user_hitzones(0, id, 255)
set_hudmessage(200, 0, 0, -1.0, 0.28, 2, 0.02, 4.0, 0.01, 0.1, 54)
show_hudmessage(id, "%L", LANG_PLAYER, "SH_VASH_EVASION_OFF")
}
}
// Sets this variable to the current status
gHasVashPower[id] = (hasPowers != 0)
}
//----------------------------------------------------------------------------------------------
public newSpawn(id)
{
if ( shModActive() && gHasVashPower[id] && is_user_alive(id) ) {
set_task(0.1, "vash_weapons", id)
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if ( wpnid != CSW_DEAGLE && wpnid > 0 ) {
new wpn[32]
get_weaponname(wpnid, wpn, 31)
engclient_cmd(id, wpn)
}
}
}
//----------------------------------------------------------------------------------------------
public vash_weapons(id)
{
if ( shModActive() && is_user_alive(id) ) {
// Just tell them here since this gets run at the right times anyway
set_hudmessage(200, 0, 0, -1.0, 0.28, 2, 0.02, 4.0, 0.01, 0.1, 54)
show_hudmessage(id, "%L", LANG_PLAYER, "SH_VASH_EVASION_ON")
shGiveWeapon(id, "weapon_deagle")
//Give him just enough ammo so as to not effect a no-reload hero
new clip, ammo
get_user_ammo(id, 26, clip, ammo)
if( ammo <= 6 ) {
shGiveWeapon(id, "ammo_50ae")
shGiveWeapon(id, "ammo_50ae")
shGiveWeapon(id, "ammo_50ae")
shGiveWeapon(id, "ammo_50ae")
}
else if( ammo > 6 && ammo <= 13 ) {
shGiveWeapon(id, "ammo_50ae")
shGiveWeapon(id, "ammo_50ae")
shGiveWeapon(id, "ammo_50ae")
}
else if( ammo > 13 && ammo <= 20 ) {
shGiveWeapon(id, "ammo_50ae")
shGiveWeapon(id, "ammo_50ae")
}
else if( ammo > 20 && ammo <= 27 ) {
shGiveWeapon(id, "ammo_50ae")
}
}
}
//----------------------------------------------------------------------------------------------
public switchmodel(id)
{
if ( !is_user_alive(id) ) return
//If holding shield don't change model, since there is no custom model with shield
new v_mdl[32]
Entvars_Get_String(id, EV_SZ_viewmodel, v_mdl, 31)
if ( containi(v_mdl, "v_shield_") != -1 ) return
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if ( wpnid == CSW_DEAGLE ) {
// Weapon Model change thanks to [CCC]Taz-Devil
Entvars_Set_String(id, EV_SZ_viewmodel, "models/shmod/vash_deagle.mdl")
}
}
//----------------------------------------------------------------------------------------------
public weaponChange(id)
{
if ( !gHasVashPower[id] || !shModActive() ) return
new wpnid = read_data(2)
if ( wpnid != CSW_DEAGLE ) return
switchmodel(id)
}
//----------------------------------------------------------------------------------------------
public vash_damage(id)
{
if ( !shModActive() || !is_user_alive(id) ) return
new damage = read_data(2)
new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
new headshot = bodypart == 1 ? 1 : 0
if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return
if ( gHasVashPower[attacker] && weapon == CSW_DEAGLE && is_user_alive(id) ) {
// do extra damage
new extraDamage = floatround(damage * get_cvar_float("vash_deaglemult") - damage)
if (extraDamage > 0) shExtraDamage(id, attacker, extraDamage, "deagle", headshot)
}
}
//----------------------------------------------------------------------------------------------
public vash_hitzones()
{
if ( !shModActive() || !hasRoundStarted() ) return
for ( new id = 1; id <= SH_MAXSLOTS; id++ ) {
if ( gHasVashPower[id] && is_user_alive(id) ) {
new hitZone
hitZone = random_num(1, 7)
switch(hitZone) {
case 1: set_user_hitzones(0, id, 127) //remove right leg hitzone
case 2: set_user_hitzones(0, id, 191) //remove left leg hitzone
case 3: set_user_hitzones(0, id, 223) //remove right arm hitzone
case 4: set_user_hitzones(0, id, 239) //remove left arm hitzone
case 5: set_user_hitzones(0, id, 247) //remove stomach hitzone
case 6: set_user_hitzones(0, id, 251) //remove chest hitzone
case 7: set_user_hitzones(0, id, 253) //remove head hitzone
}
}
}
}
//----------------------------------------------------------------------------------------------