Array (?) Error
#1

I was creating an enum for faction info and received an error on one of the lines.

pawn Код:
enum E_FACTION_DATA
{
    fID,
    fName[24],
    fType,
    fRankName[6][24], //this is the error line
    Float:fSpawnX,
    Float:fSpawnY,
    Float:fSpawnZ,
    Float:fSpawnA,
    fSpawnInterior,
    fSpawnVirtualWorld
}
new Faction[MAX_FACTIONS][E_FACTION_DATA];
Код:
error 001: expected token: "}", but found "["
What am I doing wrong here?
Reply
#2

Are you sure that the error is in that part of code?
I didn't get that error when writing it
Reply
#3

Pawn just support 3 Dimensial Arrays...you wrote a 4 Dimensial Array..thats not possible..
Reply
#4

Really? You don't recall this thread?
https://sampforum.blast.hk/showthread.php?tid=604383

Which led you to this thread?
https://sampforum.blast.hk/showthread.php?tid=541426
Reply
#5

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Pawn just support 3 Dimensial Arrays...you wrote a 4 Dimensial Array..thats not possible..
It does kind of support 4D arrays if the last dimension is used for a string size (I assume), since this works:

PHP код:
#define MAX_FACTIONS    5
enum E_FACTION_DATA
{
    
fID,
    
fName[24],
    
fType,
    
Float:fSpawnX,
    
Float:fSpawnY,
    
Float:fSpawnZ,
    
Float:fSpawnA,
    
fSpawnInterior,
    
fSpawnVirtualWorld
};
new 
Faction[MAX_FACTIONS][E_FACTION_DATA];
#define MAX_RANKS   6
enum E_FACTION_RANK_DATA
{
    
fRankName[24]
};
new 
FactionRanks[MAX_FACTIONS][MAX_RANKS][E_FACTION_RANK_DATA]; 
Reply
#6

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
It does kind of support 4D arrays if the last dimension is used for a string size (I assume), since this works:

PHP код:
#define MAX_FACTIONS    5
enum E_FACTION_DATA
{
    
fID,
    
fName[24],
    
fRankName[6][24],
    
fType,
    
Float:fSpawnX,
    
Float:fSpawnY,
    
Float:fSpawnZ,
    
Float:fSpawnA,
    
fSpawnInterior,
    
fSpawnVirtualWorld
};
new 
Faction[MAX_FACTIONS][E_FACTION_DATA];
#define MAX_RANKS   6
enum E_FACTION_RANK_DATA
{
    
fRankName[24]
};
new 
FactionRanks[MAX_FACTIONS][MAX_RANKS][E_FACTION_DATA]; 
I'll try and use this, I had forgotten that it wouldn't work since at the time, I was working with variables that were similar to the faction rank variable, but instead being outside of an enum completely.
Reply
#7

Quote:
Originally Posted by DTV
Посмотреть сообщение
I'll try and use this, I had forgotten that it wouldn't work since at the time, I was working with variables that were similar to the faction rank variable, but instead being outside of an enum completely.
I edited my code in that reply, by the way. I see that your quote contains the unedited version of my reply.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)