hmm but when i add the Item via en Sub-Plugin everythink is working Well
Head
PHP Code:
//Shop
enum _:ItemData
{
ItemName[ 32 ],
ItemCost,
ItemPlugin,
ItemFuncID
};
new Array:g_aItems;
new g_iTotalItems;
Plugin Init
PHP Code:
shop_item_add( "Waffenwette", 15, "gun_gamble" );
g_aItems = ArrayCreate( ItemData );
Plugin Natives
PHP Code:
public plugin_natives( )
{
// register our custom library
register_library( "plugin_api" );
// Native - Create Shop Item
register_native( "shop_item_add", "_shop_item_add" );
}
Error Part
PHP Code:
public _shop_item_add( iPlugin, iParams )
{
// create an array to hold our item data
new eItemData[ ItemData ];
// get item name from function
get_string( 1, eItemData[ ItemName ], charsmax( eItemData[ ItemName ] ) );
// get item cost from function
eItemData[ ItemCost ] = get_param( 2 );
// save the plugin adding the item
eItemData[ ItemPlugin ] = iPlugin;
// get item callback function
new szHandler[ 32 ];
get_string( 3, szHandler, charsmax( szHandler ) );
eItemData[ ItemFuncID ] = get_func_id( szHandler, iPlugin );
// add item to array and increase size
ArrayPushArray( g_aItems, eItemData ); // The Error accures HERE but just when lunched from Main Plugin whit Sub Plugin Works
g_iTotalItems++;
// return the index of this item in the array
// this creates the unique item index
return ( g_iTotalItems - 1 );
}
__________________