I'm trying to make my first hero... half invisibility + TMP damage + TMP at start of round + Infinite TMP bullets... very simple. I call the hero Seal, as in U.S. Navy Seal. I'm not sure if it's made before but I think my intentions on what it does is different. Well anyways, here's the code, please critisize all you want:
Code:
#include <amxmodx>
#include <superheromod>
new gHeroName[]="Seal"
new bool:gHasSealPower[SH_MAXSLOTS+1]
public plugin_init()
{
//Plugin info
register_plugin("SUPERHERO Seal", "1.0", "MyZna")
//Cvar info
register_cvar("seal_level", "5")
register_cvar("seal_tmpmult", "3.0")
//Creation info
shCreateHero(gHeroName, "Blend in, Expert TMP", "You are in the shadows, making you less visible. Your TMP will do more damage/have infinite ammo.", flase, "seal_level")
//Register events info
register_srvcmd("seal_init", "seal_init")
shRegHeroInit(gHeroName, "seal_init")
//Event info
register_event("Damage", "seal_damage", "b")
register_event("CurWeapon", "Event_weapon","be","1=1")
register_event("ResetHUD", "Event_spawn","b")
}
public seal_init()
{
new temp[6]
read_argv(1,temp,5)
new id = str_to_num(temp)
read_argv(2,temp,5)
new hasPowers = str_to_num(temp)
gHasSealPower[id] = (hasPowers != 0)
if ( !gHasSealPower[id] && is_user_connected(id) ) {
shRemSpeedPower(id)
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,255
}
}
public seal_loop()
{
for ( new id=1; id<=SH_MAXSLOTS; id++ )
{
if ( gHasSealPower[id] && is_user_alive(id) )
{
set_user_rendering(id,kRenderFxGlowShell,0,0,0,kRenderTransAlpha,128
}
}
}
public seal_damage(id)
{
if (!shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE
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 PLUGIN_CONTINUE
if(gHasSealPower[attacker] && weapon == CSW_TMP && is_user_alive(id)) {
new extraDamage = floatround(damage * get_cvar_float("seal_tmpmult") - damage)
if (extraDamage > 0) {
shExtraDamage( id, attacker, extraDamage, "seal_tmpmult", headshot )
}
}
}
public Event_weapon(id)
{
new clip = read_data(3)
if (clip == 0)
{
shReloadAmmo(id)
}
}
public Event_spawn(id)
{
if(gHasSealPower[id] && is_user_alive(id) && shModActivate())
{
shGiveWeapon(id,"CSW_TMP")
}
}
Great thanks to Ronaalda (not sure if it's spelled right) for the tutorial on how to make heros. Not sure if I did what you said right though. Also took a bit of the invis code from Stalker since the tutorial directions on how to make invis is only a function that I didn't understand. Also took a sample of what needed what and where from the Madness, Noob, and Veronika codes, so I'd not mess up too bad.
__________________