Raised This Month: $ Target: $400
 0% 

[help] multi dimensional arrays must be fully initialized


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
emerge
Junior Member
Join Date: May 2014
Old 05-23-2014 , 11:07   [help] multi dimensional arrays must be fully initialized
Reply With Quote #1

I have messed abit with Monster plugin and now it gives me error. Here i put what ive done and original code
Code:
#include <amxmodx>
#include <d2lod>
#include <engine>
#include <hamsandwich>
#include <fakemeta>

new PLUGIN_NAME[] = "MonsterMod Addon"
new PLUGIN_AUTHOR[] = "xbatista"
new PLUGIN_VERSION[] = "1.0"

#define MAX_MONSTERS 14

#define COINS_CLASSNAME "CoinsMonster"

new const Monster_Models[MAX_MONSTERS][] =
{
    "models/agrunt.mdl",
    "models/big_mom.mdl",
    "models/bullsquid.mdl",
    "models/headcrab.mdl",
    "models/hassasin.mdl",
    "models/hgrunt.mdl",
    "models/zombie.mdl",
    "models/tentacle.mdl",
    "models/babygarg.mdl",
    "models/bigrat.mdl",
    "models/islave.mdl",
    "models/w_squeak.mdl",
    "models/controller.mdl",
    "models/garg.mdl"
}
new const Monster_Xp[MAX_MONSTERS] =
{
    150, //Agrunt
    600, //BigMom
    100, //Bullsquid
    50, //Headcrab
    70, // Hassasin
    120, //Hgrunt
    80, //Zombie
    0, //Zombie
    0, //Zombie
    0, //Zombie
    0, //Zombie
    0, //Zombie
    0 //Zombie
}
new const Monster_Coins[MAX_MONSTERS] =
{
    20, //Agrunt
    70, //BigMom
    10, //Bullsquid
    20, //Headcrab
    70, //Hassasin
    70, //Hgrunt
    70, //Zombie
    0, //Zombie
    0, //Zombie
    0, //Zombie
    0, //Zombie
    0, //Zombie
    0 //Zombie
}
new const Monster_Names[MAX_MONSTERS][] =
{
    "Alien Grunt",
    "Big Momma (Boss)",
    "Bull Squid",
    "Controller",
    "Gargantua (SUPER BOSS)",
    "Head Crab",
    "Hound Eye",
    "0, //Zombie",
    "0, //Zoqmbie",
    "0, //Zowmbie",
    "0, //Zoembie",
    "0, //Zormbie",
    "0 //Zotmbie"
}

new g_iMaxPlayers;

public plugin_init() 
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

    RegisterHam(Ham_Killed, "func_wall", "Monster_Killed");

    register_touch( COINS_CLASSNAME, "player", "Coins_Pickup")

    register_logevent("Event_Round_End", 2, "1=Round_End");

    g_iMaxPlayers = get_maxplayers();
}

public Event_Round_End()
{
    Remove_All_Coin_Ents();
}

public Monster_Killed(this, idattacker, shouldgib)
{
    if ( !( 1 <= idattacker <= g_iMaxPlayers ) || !is_valid_ent(this) || !get_player_logged(idattacker) )
        return HAM_IGNORED;

    new MonsterMdl[32];

    entity_get_string( this, EV_SZ_model, MonsterMdl, charsmax(MonsterMdl) );

    for(new monsters = 0; monsters < MAX_MONSTERS; monsters++) 
    {
        if( equal( MonsterMdl, Monster_Models[monsters] ) ) 
        {
            if ( Monster_Xp[monsters] > 0 )
            {
                set_p_xp( idattacker, get_p_xp(idattacker) + Monster_Xp[monsters]);
                client_print( idattacker, print_center, "You've killed %s +%d", Monster_Names[monsters], Monster_Xp[monsters]);
            }

            if ( Monster_Coins[monsters] > 0 )
                drop_coins( this, COINS_CLASSNAME, Monster_Coins[monsters] + (get_p_level(idattacker) / 4) );
        }
    }

    return HAM_IGNORED;
}

// Touch, coins
public Coins_Pickup(ptr, ptd)
{
    if( is_user_alive(ptd) && pev_valid(ptr) ) 
    {     
        new gold = entity_get_int(ptr , EV_INT_iuser1)

        set_p_gold(ptd, get_p_gold(ptd) + gold)
                    
        remove_entity(ptr)
    }
}
public Remove_All_Coin_Ents()
{
    new coin_ent = find_ent_by_class(-1, COINS_CLASSNAME)
    
    while ( coin_ent ) 
    {
        remove_entity(coin_ent)
        coin_ent = find_ent_by_class(coin_ent, COINS_CLASSNAME)
    }
}
Heres original no error code
Code:
#include <amxmodx>
#include <d2lod>
#include <engine>
#include <hamsandwich>
#include <fakemeta>

new PLUGIN_NAME[] = "MonsterMod Addon"
new PLUGIN_AUTHOR[] = "xbatista"
new PLUGIN_VERSION[] = "1.0"

#define MAX_MONSTERS 14

#define COINS_CLASSNAME "CoinsMonster"

new const Monster_Models[MAX_MONSTERS][] =
{
    "models/agrunt.mdl",
    "models/big_mom.mdl",
    "models/bullsquid.mdl",
    "models/controller.mdl",
    "models/garg.mdl",
    "models/headcrab.mdl",
    "models/houndeye.mdl",
    "models/islave.mdl",
    "models/w_squeak.mdl",
    "models/zombie.mdl",
    "models/hgrunt.mdl",
    "models/tentacle.mdl",
    "models/babygarg.mdl",
    "models/bigrat.mdl"
}
new const Monster_Xp[MAX_MONSTERS] =
{
    150,
    600,
    100,
    120,
    0,
    50,
    70, // Houndeye
    120,
    0,
    80,
    0,
    0,
    0,
    0
}
new const Monster_Coins[MAX_MONSTERS] =
{
    20,
    70,
    10,
    20,
    0,
    3,
    10,
    25,
    0,
    15,
    0,
    0,
    0,
    0
}
new const Monster_Names[MAX_MONSTERS][] =
{
    "Alien Grunt",
    "Big Momma (Boss)",
    "Bull Squid",
    "Controller",
    "Gargantua (SUPER BOSS)",
    "Head Crab",
    "Hound Eye",
    "Slave",
    "Snark",
    "Zombie",
    "Human Grunt",
    "Tentacle",
    "Baby Garg (BOSS)",
    "Town Rat"
}

new g_iMaxPlayers;

public plugin_init() 
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR)

    RegisterHam(Ham_Killed, "func_wall", "Monster_Killed");

    register_touch( COINS_CLASSNAME, "player", "Coins_Pickup")

    register_logevent("Event_Round_End", 2, "1=Round_End");

    g_iMaxPlayers = get_maxplayers();
}

public Event_Round_End()
{
    Remove_All_Coin_Ents();
}

public Monster_Killed(this, idattacker, shouldgib)
{
    if ( !( 1 <= idattacker <= g_iMaxPlayers ) || !is_valid_ent(this) || !get_player_logged(idattacker) )
        return HAM_IGNORED;

    new MonsterMdl[32];

    entity_get_string( this, EV_SZ_model, MonsterMdl, charsmax(MonsterMdl) );

    for(new monsters = 0; monsters < MAX_MONSTERS; monsters++) 
    {
        if( equal( MonsterMdl, Monster_Models[monsters] ) ) 
        {
            if ( Monster_Xp[monsters] > 0 )
            {
                set_p_xp( idattacker, get_p_xp(idattacker) + Monster_Xp[monsters]);
                client_print( idattacker, print_center, "You've killed %s +%d", Monster_Names[monsters], Monster_Xp[monsters]);
            }

            if ( Monster_Coins[monsters] > 0 )
                drop_coins( this, COINS_CLASSNAME, Monster_Coins[monsters] + (get_p_level(idattacker) / 4) );
        }
    }

    return HAM_IGNORED;
}

// Touch, coins
public Coins_Pickup(ptr, ptd)
{
    if( is_user_alive(ptd) && pev_valid(ptr) ) 
    {     
        new gold = entity_get_int(ptr , EV_INT_iuser1)

        set_p_gold(ptd, get_p_gold(ptd) + gold)
                    
        remove_entity(ptr)
    }
}
public Remove_All_Coin_Ents()
{
    new coin_ent = find_ent_by_class(-1, COINS_CLASSNAME)
    
    while ( coin_ent ) 
    {
        remove_entity(coin_ent)
        coin_ent = find_ent_by_class(coin_ent, COINS_CLASSNAME)
    }
}
emerge is offline
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 05-23-2014 , 11:16   Re: [help] multi dimensional arrays must be fully initialized
Reply With Quote #2

Attach the d2lod.inc, we can't compile without it. Now for the error - you simpli have less/more characters in your const than the MAX_RANKS. In more cases, they are less - 13, and the MAX_RANKS is 14, so you will have to add one more.
__________________

Last edited by Flick3rR; 05-23-2014 at 11:24.
Flick3rR is offline
Send a message via Skype™ to Flick3rR
emerge
Junior Member
Join Date: May 2014
Old 05-23-2014 , 11:24   Re: [help] multi dimensional arrays must be fully initialized
Reply With Quote #3

YOu can find required files in source folder sorry for my mistake
https://forums.alliedmods.net/showpo...44&postcount=1

Last edited by emerge; 05-23-2014 at 11:25.
emerge is offline
Kiske
Veteran Member
Join Date: May 2009
Old 05-23-2014 , 11:56   Re: [help] multi dimensional arrays must be fully initialized
Reply With Quote #4

This is wrong:
PHP Code:
new const Monster_Names[MAX_MONSTERS][] =
{
    
"Alien Grunt",
    
"Big Momma (Boss)",
    
"Bull Squid",
    
"Controller",
    
"Gargantua (SUPER BOSS)",
    
"Head Crab",
    
"Hound Eye",
    
"0, //Zombie",
    
"0, //Zoqmbie",
    
"0, //Zowmbie",
    
"0, //Zoembie",
    
"0, //Zormbie",
    
"0 //Zotmbie"

PHP Code:
    "0, //Zombie",
    
"0, //Zoqmbie",
    
"0, //Zowmbie",
    
"0, //Zoembie",
    
"0, //Zormbie",
    
"0 //Zotmbie" 
__________________

Kiske is offline
Send a message via Skype™ to Kiske
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 09:47.


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