Issues with three dimensional array - 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: Issues with three dimensional array (
/showthread.php?tid=631779)
Issues with three dimensional array -
CXdur - 04.04.2017
Hey,
I am having some very strange issues with a 3D array that I have. The ranks are loaded from a database, to start out and test with I have the following ranks:
I am however getting a really weird issue, only the latest rank seems to work fine while the rest of the ranks are prefixing themselves 1 by 1 going up with the first character from the rank below (and some unrecognizeable characters).
Here's the console log:
https://pastebin.com/BKb5c5BQ
And here are all the functions I use:
https://pastebin.com/zsRWi9sT
Also, here's what I use to print the loaded ranks afterwards (from a testing command):
Код:
case _H<print_rank>:
{
LOG_DEBUG_F("Starting group ranks print, initialized by %s(%s)", PlayerName(playerid), PlayerIP(playerid));
for (new i = 0; i < sizeof(groupSpawns); i++)
{
for (new x = 1; x < MAX_GROUP_RANKS; x++)
{
if (strlen(groupRanks[i][x][1]) > 1)
{
LOG_DEBUG_F("Group %s(%d) - rank %s(%d)", groupSpawns[i][grSpawn_name], i, groupRanks[i][x][1], x);
}
}
}
}
How I create the array:
new groupSpawns[MAX_GROUPS][E_CUSTOM_GROUP_SPAWN],
groupRanks[MAX_GROUPS][MAX_GROUP_RANKS][2];
MAX_GROUP_RANKS is equal to 12.
I have never experienced an issue quite like this and I have no idea why this is happening, does anyone have an idea?
Thank you, I appreciate any help.
Re: Issues with three dimensional array -
Vin Diesel - 04.04.2017
If you have skype PM me it.
Re: Issues with three dimensional array -
CXdur - 04.04.2017
Quote:
Originally Posted by Vin Diesel
If you have skype PM me it.
|
PM has been sent, thanks.
Re: Issues with three dimensional array -
CXdur - 04.04.2017
I think I fixed it guys, if anyone is curious as to how:
Код:
enum E_CUSTOM_GROUP_RANK
{
gRank_number,
gRank_name[32]
}
All I did was basically create an enumerator so that the compiler would know the maximum string size, and it did seem to solve it.