PDA

View Full Version : Error: Array must be indexed.


Joshman543
11/06/2013, 10:32 PM
Hello, earlier today I made a gas leak system.

I have an enum etc, but I'm receiving array should be indexed errors.
Here is an example line that is receiving the error:
GasInformation[GasType] = 1;

Here is the enum:
enum glInfo
{
GasType[3],
GasObjects[5],
GasSize = 100,
GasLeak = false
}
new GasInformation[glInfo];

RALL0
11/06/2013, 10:40 PM
for(new i=0; i<3; i++)
{
GasType[i];
}
new gast = GasType[i]
GasInformation[gast] = 1

Vince
11/06/2013, 10:47 PM
Enums don't work like that! You can't assign default values in enums.

Joshman543
11/06/2013, 11:35 PM
Enums don't work like that! You can't assign default values in enums.
Can you show me how to make this work?

HurtLocker
11/06/2013, 11:41 PM
new GasType[3], GasObjects[5], GasSize = 100, bool:GasLeak = false;

iJumbo
12/06/2013, 12:46 AM
These values are global?

if yes why not set the values in OnGamemodeInit for every var?