array index out of bounds [+REP]
#1

PHP код:
#define MAX_CLANS 50
enum ClanInfo
{
    
Test[64]
}
new 
ClanDB[MAX_CLANS][ClanInfo];
// --------------------------------------------------------
function LoadClan(playeridname[], value[])
{
    
INI_String("Test",ClanDB[MAX_CLANS][Test],64);
    return 
1;

Error in line: INI_String("Test",ClanDB[MAX_CLANS][Test],64);
Reply
#2

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.
Reply
#3

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
Reply
#4

PHP код:
#define MAX_CLANS 50 

enum ClanInfo 

    
Test[64

new 
ClanDB[MAX_CLANS][ClanInfo]; 

// -------------------------------------------------------- 

function LoadClan(playeridname[], value[]) 

    
INI_String("Test",ClanDB[MAX_CLANS-1][Test],64); 
    return 
1

perhaps?
Reply
#5

Quote:
Originally Posted by PawnHunter
Посмотреть сообщение
PHP код:
#define MAX_CLANS 50 
enum ClanInfo 

    
Test[64

new 
ClanDB[MAX_CLANS][ClanInfo]; 
// -------------------------------------------------------- 
function LoadClan(playeridname[], 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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)