Raised This Month: $ Target: $400
 0% 

Problem with Arrays


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mrshakurr
Junior Member
Join Date: Dec 2011
Old 07-22-2014 , 01:36   Problem with Arrays
Reply With Quote #1

I am trying to make a skin menu so players can buy skins from points they've gained from killing others and I put everything in an array but I get an error.

This is the code.
Code:
enum _:SkinInfo
{
	SkinName[32],
	SkinVModel[64],
	SkinWModel[64],
	SkinPrice,
	SkinOwned[32]
}

new Array:g_iSkins;

public Cmd_SkinShop(id)
{
	new g_iSkinsInfo[ SkinInfo ];
	new menu = menu_create("Skin Shop", "skinshop_handler");
	for(new i = 0; i < ArraySize(g_iSkins); i++)
	{
		ArrayGetArray(g_iSkins, i, g_iSkinsInfo);
		new info[5];
		num_to_str(i, info, 4);
		new item[32];
		if( g_iSkinsInfo[ SkinOwned[id] ] == 0 )
		{
			formatex(item, 31, "%s \r[Price: %i]", g_iSkinsInfo[ SkinName ], g_iSkinsInfo[ SkinPrice ]);
			menu_additem(menu, item, info);
		}
	}
	menu_display(id, menu, 0);
}
In plugin_init, I have this.
Code:
g_iSkins = ArrayCreate(SkinInfo);
And here's the error I'm getting.

Error: Invalid subscript (not an array or too many subscripts): "SkinOwned" on line 145

I don't know what the problem is and any help would be appreciated.
mrshakurr is offline
 



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 13:12.


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