Can someone please fix this script it compiles but when i use my power on the server it does nothing its their but when i choose it it does nothing at all. i need someone to fix it and make it admin only please
Code:
//GuerillaSpartan! - Become a GuerillaSpartan
//This hero was made was using jtpizzalover's superhero generator
/* CVARS - copy and paste to shconfig.cfg
//GuerillaSpartan
GuerillaSpartan_level 20
GuerillaSpartan_health 500 //Default 100 (no extra health)
GuerillaSpartan_armor 500 //Default 150
GuerillaSpartan_gravity 1 //Default 1.0 = no extra gravity (0.50 is 50% normal gravity, ect.)
GuerillaSpartan_speed 1000 //Default -1 = no extra speed, this cvar is for all weapons (for faster then normal speed set to 261 or higher)
GuerillaSpartan_augmult 4 //Damage multiplyer for his aug
*/
#include <amxmodx>
#include <superheromod>
#include <fakemeta>
new HeroName[] = "GuerillaSpartan"
new bool:HasHero[SH_MAXSLOTS+1]
new bool:HeroModelSet[SH_MAXSLOTS+1]
new CvaraugDmgMult
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO GuerillaSpartan","amxx","&|Spartan|{IV}-Leader-&")
// DO NOT EDIT THIS FILE TO CHANGE CVARS, USE THE SHCONFIG.CFG
register_cvar("GuerillaSpartan_level", "20")
register_cvar("GuerillaSpartan_health", "500")
register_cvar("GuerillaSpartan_armor", "500")
register_cvar("GuerillaSpartan_gravity", "1")
register_cvar("GuerillaSpartan_speed", "1000")
CvaraugDmgMult = register_cvar("GuerillaSpartan_augmult", "4")
// FIRE THE EVENT TO CREATE THIS SUPERHERO!
shCreateHero(HeroName, "GuerillaSpartan", "Become a GuerillaSpartan", false, "GuerillaSpartan_level")
// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
// INIT
register_srvcmd("GuerillaSpartan_init", "GuerillaSpartan_init")
shRegHeroInit(HeroName, "GuerillaSpartan_init")
// EVENTS
register_event("ResetHUD", "new_spawn", "b")
register_event("DeathMsg", "GuerillaSpartan_death", "a")
register_event("CurWeapon", "weapon_change", "be", "1=1")
register_event("Damage", "GuerillaSpartan_damage", "b", "2!0")
// Let Server know about the hero's variables
shSetShieldRestrict(HeroName)
shSetMaxHealth(HeroName, "GuerillaSpartan_health")
shSetMaxArmor(HeroName, "GuerillaSpartan_armor")
shSetMinGravity(HeroName, "GuerillaSpartan_gravity")
shSetMaxSpeed(HeroName, "GuerillaSpartan_speed", "[0]")
}
public plugin_precache()
{
precache_model("models/shmod/GuerillaSpartan_v_aug.mdl")
precache_model("models/shmod/GuerillaSpartan_p_aug.mdl")
precache_model("models/shmod/GuerillaSpartan_w_aug.mdl")
precache_model("models/player/GuerillaSpartan/GuerillaSpartan.mdl")
}
public GuerillaSpartan_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)
//This hero was made was using jtpizzalover's superhero generator
// Reset their shield restrict status
// Shield restrict MUST be before weapons are given out
shResetShield(id)
switch(hasPowers)
{
case true:
{
HasHero[id] = true
if ( is_user_alive(id) )
{
GuerillaSpartan_weapons(id)
switch_model(id)
}
}
case false:
{
// Check is needed since this gets run on clearpowers even if user didn't have this hero
if ( is_user_alive(id) && HasHero[id] )
{
// This gets run if they had the power but don't anymore
engclient_cmd(id, "drop", "weapon_aug")
GuerillaSpartan_unmorph(id)
shRemHealthPower(id)
shRemArmorPower(id)
shRemGravityPower(id)
shRemSpeedPower(id)
}
HasHero[id] = false
}
}
}
public new_spawn(id)
{
if ( shModActive() && is_user_alive(id) && HasHero[id] )
{
set_task(0.1, "GuerillaSpartan_weapons", id)
GuerillaSpartan_tasks(id)
}
}
GuerillaSpartan_tasks(id)
{
set_task(1.0, "GuerillaSpartan_morph", id)
}
public GuerillaSpartan_weapons(id)
{
if ( !shModActive() || !is_user_alive(id) || !HasHero[id] )
return
shGiveWeapon(id, "weapon_aug")
}
switch_model(id)
{
if ( !shModActive() || !is_user_alive(id) || !HasHero[id] )
return
new clip, ammo, wpnid = get_user_weapon(id, clip, ammo)
if ( wpnid == CSW_AUG )
{
set_pev(id, pev_viewmodel2, "models/shmod/GuerillaSpartan_v_aug.mdl")
set_pev(id, pev_weaponmodel2, "models/shmod/GuerillaSpartan_w_aug.mdl")
}
}
public weapon_change(id)
{
if ( !shModActive() || !HasHero[id] )
return
new wpnid = read_data(2)
if ( wpnid != CSW_AUG )
return
switch_model(id)
new clip = read_data(3)
// Never Run Out of Ammo!
if ( clip == 0 )
shReloadAmmo(id)
}
public GuerillaSpartan_damage(id)
{
if ( !shModActive() || !is_user_alive(id) )
return
new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart)
if ( attacker <= 0 || attacker > SH_MAXSLOTS )
return
if ( HasHero[attacker] && weapon == CSW_AUG && is_user_alive(id) )
{
new damage = read_data(2)
new headshot = bodypart == 1 ? 1 : 0
// do extra damage
new extraDamage = floatround(damage * get_pcvar_float(CvaraugDmgMult) - damage)
if ( extraDamage > 0 )
shExtraDamage(id, attacker, extraDamage, "aug", headshot)
}
}
public GuerillaSpartan_morph(id)
{
if ( HeroModelSet[id] || !is_user_alive(id) || !HasHero[id] )
return
cs_set_user_model(id, "Hero")
HeroModelSet[id] = true
}
GuerillaSpartan_unmorph(id)
{
if ( HeroModelSet[id] && is_user_connected(id) )
{
cs_reset_user_model(id)
HeroModelSet[id] = false
}
}
public GuerillaSpartan_death()
{
new id = read_data(2)
if ( !HasHero[id] )
return
GuerillaSpartan_unmorph(id)
}
public client_connect(id)
{
HasHero[id] = false
HeroModelSet[id] = false
}