AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   ERROR 018: initalization data exceeds declared size (https://forums.alliedmods.net/showthread.php?t=236730)

Adomaz1 03-10-2014 09:55

ERROR 018: initalization data exceeds declared size
 
hello, I'm getting this error when I compile: error 018: initalization data exceeds declared size.

here is the code:

Quote:

#include < amxmodx >
#include < fakemeta >
#include < hamsandwich >
#include < gunxpmod >

enum _:ITEMS
{
ITEM_MAC10 = 0,
};

new const g_pluginName[ ] = "Unlock - Weapons";
new const g_pluginVersion[ ] = "1.0";
new const g_pluginAuthor[ ] = "Adomaz";

new const g_itemName[ 0 ][ ] = { "Upgrade DMP7A1 (Dual MAC)" };
new const g_itemDescription[ 0 ][ ] = { "+Aim +Rate +Power +Scope ( MAC10 )", "Hight Damage" };
new const g_itemCost[ 0 ] = { 500 };

new const g_weaponsIndex[ 0 ] = { CSW_MAC10 };
new const g_weaponsModel[ 0 ][ ] = { "models/gunxpmod/v_dmp7a1.mdl" };

new const g_cvarName[ 0 ][ ] = { "gxm_damage_mac10" };
new const g_cvarValue[ 0 ][ ] = { "2.0" };

new bool:g_hasItem[ 33 ] [ 0 ];
new g_pItemDamage[ 3 ];
new g_itemCount;

public plugin_precache( )
{
for( new i = ITEM_MAC10; i < sizeof g_weaponsModel; i++ )
engfunc( EngFunc_PrecacheModel, g_weaponsModel[ i ] );
}

public plugin_init( )
{
register_plugin( g_pluginName, g_pluginVersion, g_pluginAuthor );

for( new i = ITEM_MAC10; i < g_itemCount; i++ )
{
register_gxm_item( g_itemName[ i ], g_itemDescription[ i ], g_itemCost[ i ] );
g_pItemDamage[ i ] = register_cvar( g_cvarName[ i ], g_cvarValue[ i ] );
g_itemCount++;
}

register_event( "CurWeapon", "eventCurWeapon", "be", "1=1" );
RegisterHam( Ham_TakeDamage, "player", "hookClientTakeDamage" );
}

public gxm_item_enabled( client )
{
for( new i = ITEM_MAC10; i < g_itemCount; i++ )
g_hasItem[ client ][ i ] = true;
}

public client_connect( client )
{
for( new i = ITEM_MAC10; i < g_itemCount; i++ )
g_hasItem[ client ][ i ] = false;
}

public hookClientTakeDamage( client, inflictor, attacker, Float:damage, damageType )
{
for( new i = ITEM_MAC10; i < g_itemCount; i++ )
{
if( !g_hasItem[ attacker ][ i ] )
continue;

new weapon = get_user_weapon(attacker, _, _);
if( weapon == g_weaponsIndex[ i ] )
{
SetHamParamFloat( 4, damage * get_pcvar_float( g_pItemDamage[ i ] ) );
return HAM_SUPERCEDE;
}
}

return HAM_IGNORED;
}

public eventCurWeapon( client )
{
for( new i = ITEM_MAC10; i < g_itemCount; i++ )
{
if( !g_hasItem[ client ][ i ] )
continue;

new weapon = read_data( 2 );
if( weapon == g_weaponsIndex[ i ] )
set_pev( client, pev_viewmodel2, g_weaponsModel[ i ] );
}
}

YamiKaitou 03-10-2014 10:08

Re: ERROR 018: initalization data exceeds declared size
 
How is ITEMS defined?

Adomaz1 03-10-2014 14:01

Re: ERROR 018: initalization data exceeds declared size
 
I fixed that error, but now it says that

\unlock_dmp7a1.sma(25) : error 009: invalid array size (negative or zero)

YamiKaitou 03-10-2014 14:12

Re: ERROR 018: initalization data exceeds declared size
 
You cannot have an array with a size of 0

Adomaz1 03-10-2014 15:10

Re: ERROR 018: initalization data exceeds declared size
 
the script is now ok, but there isn't any gun upgrade in the game..:/

YamiKaitou 03-10-2014 15:21

Re: ERROR 018: initalization data exceeds declared size
 
Well, attach the SMA and the required files and describe what should be occuring


All times are GMT -4. The time now is 05:54.

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