Raised This Month: $ Target: $400
 0% 

Whats wrong with this hero i scripted?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Shular
Junior Member
Join Date: Nov 2007
Old 11-21-2007 , 03:55   Re: Whats wrong with this hero i scripted?
Reply With Quote #4

look i went off someones tutorial and the dagger spelling didnt matter but thanks. and idk wat u mean by the cvar is named

Heres wat ive edited so far...
Code:
#include <amxmodx>
#include <superheromod>

new gHeroName[]="PeterPan"

new bool:gHasSuperPower[SH_MAXSLOTS+1]

public plugin_init() {
    register_plugin(""gHeroName", "1.0", "Shular")
    register_cvar("Super_level", "10")

    shCreateHero(gheroName[], "Fly, Super Dagger", 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
    register_cvar("Supher_mult", "1.5"); //how much damage to do (1.5 x normal_damage)
}

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 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



Last edited by Shular; 11-21-2007 at 04:06.
Shular is offline
 



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