SA-MP Forums Archive
invalid array size (negative, zero or out of bounds) - 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: invalid array size (negative, zero or out of bounds) (/showthread.php?tid=526551)



invalid array size (negative, zero or out of bounds) - Lucky™ - 18.07.2014

I'm having another problem over here. I tried some ways to fix this but none of them worked.

This is the error:
pawn Код:
invalid array size (negative, zero or out of bounds)
This is the line where error occurs:
pawn Код:
new WeaponInfo[MAX_WEAPONS][wInfo];
Any help would be great.


Re: invalid array size (negative, zero or out of bounds) - Aerotactics - 18.07.2014

Is MAX_WEAPONS defined? I'm not certain it's defined by default.


Re: invalid array size (negative, zero or out of bounds) - Lucky™ - 18.07.2014

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Is MAX_WEAPONS defined? I'm not certain it's defined by default.
Yes, it is defined.

pawn Код:
#define MAX_WEAPONS 2000



Re: invalid array size (negative, zero or out of bounds) - Aerotactics - 18.07.2014

Show your wInfo array please.


Re: invalid array size (negative, zero or out of bounds) - Lucky™ - 18.07.2014

pawn Код:
enum wInfo
{
        wObject,
        wWeaponID,
        Float:wWeaponX,
        Float:wWeaponY,
        Float:wWeaponZ,
        Float:wWeaponRot,
        wWeaponInt,
        wWeaponVW,
        wWeaponFaction,
};



Re: invalid array size (negative, zero or out of bounds) - Aerotactics - 18.07.2014

Make MAX_WEAPONS = 200, to see if 2000 is out of bounds.


Re: invalid array size (negative, zero or out of bounds) - Lucky™ - 18.07.2014

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
Make MAX_WEAPONS = 200, to see if 2000 is out of bounds.
No luck. Same error.


Re: invalid array size (negative, zero or out of bounds) - Aerotactics - 18.07.2014



wWeaponFaction,

remove the comma lol


Re: invalid array size (negative, zero or out of bounds) - Lucky™ - 18.07.2014

pawn Код:
error 017: undefined symbol "wInfo"
error 009: invalid array size (negative, zero or out of bounds)
Still error in this line:
pawn Код:
new WeaponInfo[MAX_WEAPONS][wInfo];



Re: invalid array size (negative, zero or out of bounds) - Aerotactics - 18.07.2014

I can't tell the issue right away then. Sorry.