Raised This Month: $ Target: $400
 0% 

Whats wrong with this hero i scripted?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Shular
Junior Member
Join Date: Nov 2007
Old 11-20-2007 , 20:01   Whats wrong with this hero i scripted?
Reply With Quote #1

Ok i scripted up this hero "Peter Pan" this isnt the full finished version but this was off someones tutorial and i went and copied it into the compiler tool on the amx home page but this said
1.Error
Here it is im not sure what i did wrong.

Code:
#include <amxmodmenu>
#include <superheromod>

new gHeroName[]="Peter Pan"

new bool:gHasSuperPower[SH_MAXSLOTS+1]

public plugin_init() {
    register_plugin(""Peter Pan", "1.0", "Rolnaaba")
    register_cvar(Super_level", "10")

    shCreateHero(gHeroName, "Fly, Super Daggar", "Peter Pan can fly and has more HP and Quik stabb and a stronger knife", false, "Super_level")
    //superheromod.inc:
    //stock shCreateHero(heroName[], heroPower[], heroHelp[], bool:requiresKeyEvents, heroLevel[])

    register_srvcmd("super_init", "Super_init"); //register your hero's init function with server
    
    shRegHeroInit(gHeroName, "Super_init"); //register your hero's init with superheromod
}

public Super_init() {
    new temp[6]; //declare a temperary varriable
    read_argv(1,temp,5); //reading the first argument will give you the id of the person who selected your hero
    new id = str_to_num(temp); //transfer the string returned into a number and store it as the id

    read_argv(2,temp,5); //second argument is whether they have the power or not
    
    new hasPowers = str_to_num(temp);

    gHasSuperPower[id] = (hasPowers != 0); //(hasPowers != 0) will either return 1 (if it is true that hasPowers != 0), or 0 (if it is false that hasPowers != 0)
}

public plugin_init() {
    //...
   
    //see helpful links for event info
    register_event("Damage", "Event_damage","b");

    register_cvar("Supher_mult", "1.5"); //how much damage to do (1.5 x normal_damage)
}

public Event_damage(id) {
    if (!shModActive() || !is_user_alive(id)) return PLUGIN_CONTINUE;

    new damage = read_data(2); //this is covered in my events tut. (in helpful links)
    new weapon, bodypart, attacker = get_user_attacker(id, weapon, bodypart) //store what weapon used, bodypart hit, and attacker
    new headshot = bodypart == 1 ? 1 : 0 //this is just short for:
    /*if (bodypart == 1) {
        headshot = 1;
    } else {
        headshot = 0;
    }*/

    if(attacker <= 0 || attacker > SH_MAXSLOTS ) return PLUGIN_CONTINUE; //checks ifs it was world that did the damage, and if so just end function.

    if(gHasSuperPower[attacker] && is_user_alive(id)) { //if alive and have power
        
     new extraDamage = floatround(damage * get_cvar_float("Super_mult") - damage); //calculate extra damage ([damage done x multiplier] - damage done = extra damage)
    
        if (extraDamage > 0) {
            shExtraDamage( id, attacker, extraDamage, "Super damage Mult", headshot ); //superheromod.inc: stock shExtraDamage(id, attacker, damage, weaponDescription[], headshot = 0);
     }
    }
}
__________________
My Heros
Koolaid|-----50%-----|
PeterPan|-------70%---|
Spawn|----40%------|
Hollywood
Complete
CastorTroy
Complete
YosemiteSam
Complete


Shular is offline
 


Thread Tools
Display Modes

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 01:19.


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