Clan DT Forum

    How To Create A Hero Before Adding Hp etc

    Share
    avatar
    Dr. Jan Itor


    Number of posts : 66
    Age : 28
    Location : there.
    Steam ID : STEAM_0:1:16785387
    Warning :
    0 / 1000 / 100

    Karma : Infintely Awesome
    Reputation : 0
    Registration date : 2008-03-30

    How To Create A Hero Before Adding Hp etc

    Post by Dr. Jan Itor on Mon Apr 14, 2008 4:24 pm

    Introduction/Prolouge
    Beaware that anywhere you see "Super" or "Super Hero" should be changed to your hero's name.
    Also know that everytime you see this: "//..." it means you should know what goes there, if anything does.
    Now before we begin these things you must know how to make a superhero:
    First (conventionally) are your includes, basic includes for most heroes are as follows:




    Code:
    #include <amxmodx>
    #include <superheromod>


    if you need other includes besides these I will note them for you, otherwise these are always included in a superhero script

    Next you declare your glabal varriables which will include your hero's name, and if they have your hero's powers or not. (other varrs will be added later for special powers), in this tutorial the hero's name is: Super, but of course you will change Super to whatever you want your hero to be called.


    Code:
    new gHeroName[]="Super Hero" //creates a string varr to hold your hero's name

    new bool:gHasSuperPower[SH_MAXSLOTS+1] //creates a varr with an aray, with 1 slot per player

    Now comes the plugin_init this is where all registers go that will be used in your plugin:



    Code:
    public plugin_init() {
        register_plugin("SUPERHERO Super", "1.0", "Rolnaaba"); //register plugin (you should know what this is)
     
        register_cvar("Super_level", "1"); //level required to select hero

        shCreateHero(gHeroName, "Hero Power List", "Hero Discription", false, "Super_level");
        http://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
    }


    Now your Hero's Init function, this is called anytime someone picks your hero



    Code:
    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)


    Putting These Together Creates:



    Code:
    #include <amxmodx>
    #include <superheromod>

    new gHeroName[]="Super Hero" //creates a string varr to hold your hero's name
    new bool:gHasSuperPower[SH_MAXSLOTS+1] //creates a varr with an aray, with 1 slot per player

    public plugin_init() {
        register_plugin("SUPERHERO Super", "1.0", "UR MOM); //register plugin (you should know what this is)
     
        register_cvar("Super_level", "1"); //level required to select hero

        shCreateHero(gHeroName, "Hero Powers", "Hero Discription", false, "Super_level"); http://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)
    }


    _________________
    OH, Hello Guest

      Current date/time is Sun May 20, 2018 4:43 pm