Raised This Month: $ Target: $400
 0% 

Whats wrong with this hero i scripted?


Post New Thread Reply   
 
Thread Tools Display Modes
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
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-21-2007 , 01:47   Re: Whats wrong with this hero i scripted?
Reply With Quote #2

1. This is the wrong section.
2. Line 1: You wrote "amxmodmenu", supposed to be "amxmodx".
3. Line 9: You have a " to much.
4. Line 10: You're missing a ".
5. line 33: You have 2 plugin_init(), Move all the stuff from one to another as you can only have one.

(6. Line 10: The cvar is named stupid.)
(7. Line 12: It's spelled dagger.)
(8. Line 39: The cvar is named stupid.)
[ --<-@ ] Black Rose is offline
Bad_Bud
Senior Member
Join Date: Oct 2006
Location: The internet
Old 11-22-2007 , 05:28   Re: Whats wrong with this hero i scripted?
Reply With Quote #3

Quote:
Originally Posted by [ --<-@ ] Black Rose View Post
1. This is the wrong section.
2. Line 1: You wrote "amxmodmenu", supposed to be "amxmodx".
3. Line 9: You have a " to much.
4. Line 10: You're missing a ".
5. line 33: You have 2 plugin_init(), Move all the stuff from one to another as you can only have one.

(6. Line 10: The cvar is named stupid.)
(7. Line 12: It's spelled dagger.)
(8. Line 39: The cvar is named stupid.)
I probably should not have loled at this.
__________________
Bad_Bud is offline
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
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-21-2007 , 04:56   Re: Whats wrong with this hero i scripted?
Reply With Quote #5

register_cvar("Super_level", "10")
register_cvar("Supher_mult", "1.5"); //how much damage to do (1.5 x normal_damage)
By cvars I meant these.
Yuu should name em something like peterpan_level and peterpan_mult.
Cuz noone will remember that Super_level and Supher_mult is for peter pan.
[ --<-@ ] Black Rose is offline
Shular
Junior Member
Join Date: Nov 2007
Old 11-21-2007 , 15:06   Re: Whats wrong with this hero i scripted?
Reply With Quote #6

oh ok thanks for all the help
__________________
My Heros
Koolaid|-----50%-----|
PeterPan|-------70%---|
Spawn|----40%------|
Hollywood
Complete
CastorTroy
Complete
YosemiteSam
Complete


Shular is offline
Shular
Junior Member
Join Date: Nov 2007
Old 11-21-2007 , 15:12   Re: Whats wrong with this hero i scripted?
Reply With Quote #7

How would I fix these?
Code:
/home/groups/amxmodx/tmp3/textf2yecb.sma(9) : error 001: expected token: ",", but found "-identifier-"
/home/groups/amxmodx/tmp3/textf2yecb.sma(9) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/textf2yecb.sma(9) : error 001: expected token: ";", but found "-string-"
/home/groups/amxmodx/tmp3/textf2yecb.sma(9) : warning 215: expression has no effect
/home/groups/amxmodx/tmp3/textf2yecb.sma(9) : error 001: expected token: ";", but found "-rational value-"
/home/groups/amxmodx/tmp3/textf2yecb.sma(9) : fatal error 107: too many error messages on one line
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("{PeterPan_init", "PeterPan_init");
    
    shRegHeroInit(PeterPan, "PeterPan_init");
    register_cvar("PeterPan_mult", "1.5");
}

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


Shular is offline
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 11-21-2007 , 18:58   Re: Whats wrong with this hero i scripted?
Reply With Quote #8

This is how it looks:
Code:
register_plugin(""gHeroName", "1.0", "Shular")

This is how it should look:
Code:
register_plugin("gHeroName", "1.0", "Shular")
You figure it out.
Get AMXx Studio.
[ --<-@ ] Black Rose is offline
Shular
Junior Member
Join Date: Nov 2007
Old 11-22-2007 , 00:33   Re: Whats wrong with this hero i scripted?
Reply With Quote #9

k thanks
__________________
My Heros
Koolaid|-----50%-----|
PeterPan|-------70%---|
Spawn|----40%------|
Hollywood
Complete
CastorTroy
Complete
YosemiteSam
Complete


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


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