Little problem about arrays.
#1

[Problem solved : If you have some troubles using arrays, I would recommend this tutorial : https://sampforum.blast.hk/showthread.php?tid=318212
]


Hello everybody !

These days I'm looking on the U-RP Gamemode that was released, and I try to add 2 more ranks for factions, I mean that factions will now have 8 ranks, not 6 anymore, everything was great until I met arrays.

I compiled, and this is what I get :

Quote:

C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8861) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8862) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8870) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8871) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8879) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8880) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(888 : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8889) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8897) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(889 : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8906) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8907) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8915) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8916) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8924) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8925) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8933) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8934) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8942) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(8943) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(9201 -- 9249) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(9201 -- 925 : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(9201 -- 9267) : error 032: array index out of bounds (variable "FactionRank")
C:\Users\Geo\Desktop\U-RP [ENG - 0.3x]\gamemodes\U-RP.pwn(9201 -- 9267) : fatal error 107: too many error messages on one line


Ok so for example let's take lines 8861-8862 (where I get the error !):
pawn Код:
strmid(FactionRank[1][7], arrCoords[46], 0, strlen(arrCoords[46]), 255);
        strmid(FactionRank[1][8], arrCoords[47], 0, strlen(arrCoords[47]), 255);
Now let's take the 6 lines before these 2 lines 8855-8860 :
pawn Код:
strmid(FactionRank[1][1], arrCoords[40], 0, strlen(arrCoords[40]), 255);
        strmid(FactionRank[1][2], arrCoords[41], 0, strlen(arrCoords[41]), 255);
        strmid(FactionRank[1][3], arrCoords[42], 0, strlen(arrCoords[42]), 255);
        strmid(FactionRank[1][4], arrCoords[43], 0, strlen(arrCoords[43]), 255);
        strmid(FactionRank[1][5], arrCoords[44], 0, strlen(arrCoords[44]), 255);
        strmid(FactionRank[1][6], arrCoords[45], 0, strlen(arrCoords[45]), 255);


What is the problem ?
Can someone explain to me how arrays really work in this case ?
What have I done wrong ?
How may I correct it ?
Do you have any tips to give to me about arrays ?

Thanks in advance.
Reply


Messages In This Thread
[Solved] Little problem about arrays. - by Kethrios - 24.06.2013, 15:51
Re : Little problem about arrays. - by Kethrios - 24.06.2013, 19:55
Re: Little problem about arrays. - by Vince - 24.06.2013, 19:58
Re : Little problem about arrays. - by Kethrios - 24.06.2013, 20:10

Forum Jump:


Users browsing this thread: 3 Guest(s)