Raised This Month: $51 Target: $400
 12% 

First Hero... Need help/wont compile


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MyZna
Member
Join Date: Aug 2007
Old 08-11-2007 , 16:20   First Hero... Need help/wont compile
Reply With Quote #1

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.
__________________
I am 68% addicted to Counterstrike. What about you?

Last edited by MyZna; 08-11-2007 at 16:24.
MyZna is offline
yang
Veteran Member
Join Date: May 2005
Location: galoreservers.net
Old 08-12-2007 , 22:32   Re: First Hero... Need help/wont compile
Reply With Quote #2

and the 4 errors are?
__________________
yang is offline
Send a message via AIM to yang
XzY
Junior Member
Join Date: Oct 2005
Location: Hell
Old 08-13-2007 , 01:16   Re: First Hero... Need help/wont compile
Reply With Quote #3

Here you go!
Your errors was your spelling "flase, shModActivate" etc. I changed some stuff too, just compare the scripts see what i changed.

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.", false, "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

    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(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) && shModActive())
    {
        shGiveWeapon(id,"weapon_tmp")
    
   }
}
//----------------------------------------------------------------------------------------------
XzY is offline
Send a message via MSN to XzY
MyZna
Member
Join Date: Aug 2007
Old 08-13-2007 , 08:03   Re: First Hero... Need help/wont compile
Reply With Quote #4

Thanks XzY. I made this hero into a fully-locked US Marine kind of hero. Check it out. http://forums.alliedmods.net/showthread.php?t=59388

Btw, I see you've added the invisibility part that I don't have on the finished hero. I'll review that and try to make another hero using that same function. Appreciated.
__________________
I am 68% addicted to Counterstrike. What about you?
MyZna is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:31.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode