array index out of bounds [+REP] - 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: array index out of bounds [+REP] (
/showthread.php?tid=611694)
array index out of bounds [+REP] -
Lirbo - 09.07.2016
PHP код:
#define MAX_CLANS 50
enum ClanInfo
{
Test[64]
}
new ClanDB[MAX_CLANS][ClanInfo];
// --------------------------------------------------------
function LoadClan(playerid, name[], value[])
{
INI_String("Test",ClanDB[MAX_CLANS][Test],64);
return 1;
}
Error in line: INI_String("Test",ClanDB[MAX_CLANS][Test],64);
Re: array index out of bounds [+REP] -
Stinged - 09.07.2016
You can't use the number X in an array with the size of X.
Meaning, you can't use MAX_CLANS(=50) in ClanDB[MAX_CLANS][ClanInfo];
You have to use something lower than that.
Re: array index out of bounds [+REP] -
Lirbo - 09.07.2016
Quote:
Originally Posted by Stinged
You can't use the number X in an array with the size of X.
Meaning, you can't use MAX_CLANS(=50) in ClanDB[MAX_CLANS][ClanInfo];
You have to use something lower than that.
|
lol? I tried with 20, then with 10, then with 3, then with 1... still the same
Re: array index out of bounds [+REP] -
iKarim - 09.07.2016
PHP код:
#define MAX_CLANS 50
enum ClanInfo
{
Test[64]
}
new ClanDB[MAX_CLANS][ClanInfo];
// --------------------------------------------------------
function LoadClan(playerid, name[], value[])
{
INI_String("Test",ClanDB[MAX_CLANS-1][Test],64);
return 1;
}
perhaps?
Re: array index out of bounds [+REP] -
Lirbo - 09.07.2016
Quote:
Originally Posted by PawnHunter
PHP код:
#define MAX_CLANS 50
enum ClanInfo
{
Test[64]
}
new ClanDB[MAX_CLANS][ClanInfo];
// --------------------------------------------------------
function LoadClan(playerid, name[], value[])
{
INI_String("Test",ClanDB[MAX_CLANS-1][Test],64);
return 1;
}
perhaps?
|
haha thanks man but i found another way, I wanted to do it for all of the clans so i forgot to make a loop that would just do it for all of them
anyway +rep for the help