SA-MP Forums Archive
Array (?) Error - 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 (?) Error (/showthread.php?tid=619707)



Array (?) Error - DTV - 21.10.2016

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?


Re: Array (?) Error - RockyGamer - 21.10.2016

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


Re: Array (?) Error - Kaliber - 21.10.2016

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


Re: Array (?) Error - Threshold - 21.10.2016

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


Re: Array (?) Error - AndySedeyn - 21.10.2016

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]; 



Re: Array (?) Error - DTV - 21.10.2016

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.


Re: Array (?) Error - AndySedeyn - 21.10.2016

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.