View Single Post
Supremache
Veteran Member
Join Date: Sep 2019
Location: Egypt
Old 04-21-2022 , 22:15   Re: how to add item for the category number 8 of the menu
Reply With Quote #12

Quote:
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 }
I tried this but it doesn't work.

Quote:
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.
Can you give me an example
__________________
Youtube.com/Supremache

Bank System [Nvault - SQL Support]
VIP System
  • If you think it's that simple, then do it yourself.
Supremache is offline