Raised This Month: $ Target: $400
 0% 

Solved how to add item for the category number 8 of the menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 04-21-2022 , 21:46   Re: how to add item for the category number 8 of the menu
Reply With Quote #11

The problem is that ArraySize is returning the number of items of both "Locations", 1 and 2, altogether.
To fix that, either create one array for each "Location" or implement your own ArraySize ignoring all "Locations" but the specified.

Code:
LocationItemCount(location) {     new total         for (new i, count = ArraySize(g_menuItems), data[ArrayTest]; i < count; i++)     {         ArrayGetArray(g_menuItems, i, data)         if (location == data[Location])         {             total++         }     }     return total }

Personally, I would create one array for each menu, it's simpler and easier to maintain, the way you are doing it now is overcomplicated and won't get any real benefit compared to multiple arrays, but that's just my opinion, you're free to use whatever method you want.
__________________








CrazY. 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 11:16.


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