PDA

View Full Version : Errors in hero - I have no idea how to fix these.


badkarma
11-06-2004, 07:56
Ok, my hero (Vanishing Smokey) isn't working, even though I fixed all the errors that I know how to fix, these are the ones that I cannot fix.

here is the sma, below the small code are the errors

#include <amxmodx>
#include <fun>
#include <engine>
#include <superheromod>

// The Invisible Man - Well Duh try guessing his power :p

// CVARS
// svanish_level - what level must they be for The Invisible Man's powers?

// VARIABLES
new gHeroName[]="Invisble Smokey"
new gHasSvanishPower[SH_MAXSLOTS+1]
new gPlayerMaxHealth[SH_MAXSLOTS+1]
//----------------------------------------------------------------------------------------------
public plugin_init()
{
// Plugin Info
register_plugin("SUPERHERO Vanishing Smokey","1.0","AssKicR, |NsT| Smokey")

// FIRE THE EVENT TO CREATE THIS SUPERHERO!
if ( isDebugOn() ) server_print("Attempting to create Vanishing Smokey Hero")
if ( !cvar_exists("svanish_level") ) register_cvar("svanish_level", "15")
shCreateHero(gHeroName, "Knife Hero", "Makes you 100 invisible while not zooming or moving. Knife Extras.", false,

"svanish_level" )

// REGISTER EVENTS THIS HERO WILL RESPOND TO! (AND SERVER COMMANDS)
register_event("ResetHUD","newRound","b")
// INIT
register_srvcmd("svanish_init", "svanish_init")
shRegHeroInit(gHeroName, "svanish_init")

// CHECK SOME BUTTONS
set_task(0.01,"check_attack",0,"",0,"b")
set_task(0.01,"check_two_buttons",0,"",0,"b")
set_task(0.01,"check_move_buttons",0,"",0,"b")

// DEFAULT THE CVARS
register_cvar("svanish_invisibility", "100")
register_cvar("svanish_cloakedmove", "0")
register_cvar("svanish_gravity", "0.10" )
register_cvar("svanish_armor", "950")
register_cvar("svanish_health", "500")
register_cvar("svanish_healpoints", "5" )
register_cvar("svanish_knifespeed", "950")
register_cvar("svanish_knifemult", "2.5" )
register_cvar("svanish_speed", "800" )
shSetMaxHealth(gHeroName, "svanish_health" )
shSetMinGravity(gHeroName, "svanish_gravity" )
shSetMaxArmor(gHeroName, "svanish_armor" )
}
//----------------------------------------------------------------------------------------------
public svanish_loop()
{
if (!shModActive()) return
for ( new id = 1; id <= SH_MAXSLOTS; id++ ) {
if ( g_HasSvanishPowers[id] && is_user_alive(id) ) {
// Let the server add the hps back since the # of max hps is controlled by it
// I.E. Superman has more than 100 hps etc.
shAddHPs(id, get_cvar_num("svanish_healpoints"), gPlayerMaxHealth[id] )
}
}
}
//----------------------------------------------------------------------------------------------
public svanish_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)

if ( attacker <= 0 || attacker > SH_MAXSLOTS ) return PLUGIN_CONTINUE

if ( g_hasSvanishPowers[attacker] && weapon == CSW_KNIFE && is_user_alive(id) ) {
// do extra damage
new extraDamage = floatround(damage * get_cvar_float("svanish_knifemult") - damage)
if (extraDamage > 0) shExtraDamage( id, attacker, extraDamage, "Invisible Dagger" )
}
return PLUGIN_CONTINUE
}
//----------------------------------------------------------------------------------------------
public svanish_MaxHealth()
{
new id[6]
new health[9]

read_argv(1,id,5)
read_argv(2,health,8)

gPlayerMaxHealth[str_to_num(id)] = str_to_num(health)
}
//----------------------------------------------------------------------------------------------
public svanish_init()
{
new temp[128]
// 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 svanish
read_argv(2,temp,5)
new hasPowers=str_to_num(temp)
gHasSvanishPower[id]=(hasPowers!=0)

// Got to remove the powers if he is not The Invisible Man
if ( !hasPowers )
unsvanish(id)
shRemHealthPower(id)
shRemGravityPower(id)
shRemArmorPower(id)

//Give Powers to the Invisible Man
if ( hasPowers )
svanish(id)
}

public newRound(id)
{
if ( is_user_alive(id) && gHasSvanishPower[id]) {
svanish(id)
}
}

public svanish(id) {
set_user_rendering(id,kRenderFxGlowShell,8,8, 8,kRenderTransAlpha,get_cvar_num("svanish_invisibility"))
}

public unsvanish(id) {
set_user_rendering(id,kRenderFxGlowShell,0,0, 0,kRenderTransAlpha,255)
}

public check_attack() {

for(new i = 1; i <= get_maxplayers(); ++i) {
if (is_user_alive(i)) {
if ((get_user_button(i)&IN_ATTACK) && gHasSvanishPower[i]) {
unsvanish(i)
}
else if (!(get_user_button(i)&IN_ATTACK) && gHasSvanishPower[i]) {
svanish(i)
}
}
}
return PLUGIN_CONTINUE
}

public check_two_buttons() {

for(new i = 1; i <= get_maxplayers(); ++i) {
if (is_user_alive(i)) {
if ((get_user_button(i)&IN_USE) && gHasSvanishPower[i]) {
unsvanish(i)
}
if ((get_user_button(i)&IN_ATTACK2) && gHasSvanishPower[i]) {
unsvanish(i)
}
}
}
return PLUGIN_CONTINUE
}

public check_move_buttons() {
if (get_cvar_num("svanish_cloakedmove")==1) return PLUGIN_HANDLED

for(new i = 1; i <= get_maxplayers(); ++i) {
if (is_user_alive(i)) {
if ((get_user_button(i)&IN_BACK) && gHasSvanishPower[i]) {
unsvanish(i)
}
if ((get_user_button(i)&IN_MOVELEFT) && gHasSvanishPower[i]) {
unsvanish(i)
}
if ((get_user_button(i)&IN_MOVERIGHT) && gHasSvanishPower[i]) {
unsvanish(i)
}
if ((get_user_button(i)&IN_FORWARD) && gHasSvanishPower[i]) {
unsvanish(i)
}
if ((get_user_button(i)&IN_RUN) && gHasSvanishPower[i]) {
unsvanish(i)
}
}
}
return PLUGIN_CONTINUE
}