SA-MP Forums Archive
Error: Array must be indexed. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Error: Array must be indexed. (/showthread.php?tid=443395)



Error: Array must be indexed. - Joshman543 - 11.06.2013

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];



Re: Error: Array must be indexed. - RALL0 - 11.06.2013

for(new i=0; i<3; i++)
{
GasType[i];
}
new gast = GasType[i]
GasInformation[gast] = 1


Re: Error: Array must be indexed. - Vince - 11.06.2013

Enums don't work like that! You can't assign default values in enums.


Re: Error: Array must be indexed. - Joshman543 - 11.06.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
Enums don't work like that! You can't assign default values in enums.
Can you show me how to make this work?


AW: Error: Array must be indexed. - HurtLocker - 11.06.2013

pawn Код:
new GasType[3], GasObjects[5], GasSize = 100, bool:GasLeak = false;



Re: Error: Array must be indexed. - iJumbo - 11.06.2013

These values are global?

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