Raised This Month: $32 Target: $400
 8% 

error 028: invalid subscript (not an array or too many subscripts)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
IAmReallyCool
Member
Join Date: Nov 2013
Old 03-15-2015 , 09:06   error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #1

Code:
static const Float:Loot_GlowColor[ ][ 3 ] = {     {            255.0,     255.0,  10.0     },                                    // ITEM_ANKH     {            10.0,   10.0,       255.0          },                                                // ITEM_BOOTS     {            255.0,     10.0,     10.0          },                                                // ITEM_CLAWS     {            10.0,   255.0,   255.0     },                                    // ITEM_CLOAK     {            10.0,   255.0,   10.0          },                                                // ITEM_MASK     {            96.0,   36.0,       196.0          },                                                // ITEM_NECKLACE     {            255.0,     255.0,  255.0                    },                        // ITEM_FROST     {            255.0,     10.0,     255.0     },                                    // ITEM_HEALTH     {            2.0,     255.0,    255.0          },                                                // ITEM_TOME     {            128.0,     128.0,  64.0     },                                    // ITEM_SCROLL     {            255.0,     128.0,  0.0            },                                                // ITEM_PROTECTANT     {            0.0,     0.0,   128.0                    },                        // ITEM_HELM     {            255.0,     0.0,       128.0          },                                                // ITEM_AMULET     {            0.0,     255.0,    64.0               },            // ITEM_SOCK     {            255.0,     255.0,  128.0                    },                        // ITEM_GLOVES     {            0.0,     128.0,    64.0               },            // ITEM_RING     {            128.0,     255.0,  0.0            },                                                // ITEM_CHAMELEON     {            100.0,     128.0,  0.0            }            // ITEM_MOLE };

Code:
entity_set_vector( NewItem, EV_VEC_rendercolor, Loot_GlowColor[ g_iShopMenuItems[ id ][ ITEM_SLOT_ONE ] ] );

What seems to be the problem?
IAmReallyCool is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-15-2015 , 10:25   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #2

You must need to define a array size:

Loot_GlowColor[ ]
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-15-2015 , 10:41   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #3

Compiles fine with 1.8.3-dev compiler
__________________
Arkshine is offline
IAmReallyCool
Member
Join Date: Nov 2013
Old 03-15-2015 , 10:45   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
Compiles fine with 1.8.3-dev compiler
Oh, I am using AmxModX 1.8.2. So should I update to 1.8.3 dev build?

E: @SmileY, I have defined array sizem still, getting the same error!

Last edited by IAmReallyCool; 03-15-2015 at 10:47.
IAmReallyCool is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-15-2015 , 10:54   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #5

I'm using an older compiler (per the version in output) and also no issue:
Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Header size:            180 bytes
Code size:              252 bytes
Data size:          1002384 bytes
Stack/heap size:      16384 bytes; estimated max. usage=39 cells (156 bytes)
Total requirements: 1019200 bytes
Done.
__________________

Last edited by Bugsy; 03-15-2015 at 10:55.
Bugsy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-15-2015 , 10:56   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #6

No no, not necessarily, I can't test with 1.8.2 compiler, so tried 1.8.3-dev. In dev version few things have fixed around compiler.

Tried with the online compiler which uses 1.8.2 and I don't get this error. Could you past a test plugin, ready as it is, so I can see what you're really doing?
__________________
Arkshine is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-15-2015 , 14:07   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #7

Quote:
Originally Posted by ^SmileY View Post
You must need to define a array size:

Loot_GlowColor[ ]
No, he does not need to define the either dimension when declaring constants like that.
__________________
fysiks is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 03-15-2015 , 21:32   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
No, he does not need to define the either dimension when declaring constants like that.
Yes, but seems to be he is using this:

PHP Code:
g_iShopMenuItemsid ][ ITEM_SLOT_ONE 
Inside a array, but anyway is a compiler error
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-15-2015 , 21:52   Re: error 028: invalid subscript (not an array or too many subscripts)
Reply With Quote #9

Quote:
Originally Posted by ^SmileY View Post
Yes, but seems to be he is using this:

PHP Code:
g_iShopMenuItemsid ][ ITEM_SLOT_ONE 
Inside a array, but anyway is a compiler error
He just needs to make sure that he never assigns a value in that array that is greater than or equal to sizeof(Loot_GlowColor).
__________________
fysiks is offline
Reply


Thread Tools
Display Modes

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 14:26.


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