Enum help.
#1

Hi!

Код:
enum fdata
{
 ...
	fRanks[29][256],
	fName[3][256]
}
new FractionInfo[MAX_FACTIONS][fdata];
Error:
Код:
error 001: expected token: "}", but found "["
error 010: invalid function or declaration
error 017: undefined symbol "fName"
error 029: invalid expression, assumed zero
warning 215: expression has no effect
error 001: expected token: ";", but found "]"
fatal error 107: too many error messages on one line
How do I fix it
Reply
#2

show the code that have the error's
Reply
#3

pawn Код:
enum fdata
{
 ...  <--- remove that ?
    fRanks[29][256],
    fName[3][256]
}
new FractionInfo[MAX_FACTIONS][fdata];
remove the ...
or maybe you need to add a ; at the bracket above new
Reply
#4

pawn Код:
enum fdata
{
    fRanks,
    fName,//you still need to add a comma even it its the last one
}; //you forgot the semi colon
new FractionInfo[MAX_FACTIONS][fdata];
Try that! Fixed it for you, and added a few notes
Reply
#5

In Pawn an array can have only up to three dimensions. (as opposed to C/C++, which can be up to 5)
Here you have four dimensions :

Код:
enum fdata
{
 ...
	fRanks[29][256],
	fName[3][256]
}
new FractionInfo[MAX_FACTIONS][fdata];

[MAX_FACTION] -> 1
[fdata] -> 2
[29] / [3] -> 3
[256] -> 4
Don't hesitate to read that : https://sampforum.blast.hk/showthread.php?tid=318212
Reply
#6

Quote:
Originally Posted by FunnyBear
Посмотреть сообщение
pawn Код:
enum fdata
{
    fRanks,
    fName,//you still need to add a comma even it its the last one
}; //you forgot the semi colon
new FractionInfo[MAX_FACTIONS][fdata];
Try that! Fixed it for you, and added a few notes
not true you dont need to add a comma when its the last one
Reply
#7

you can't set multidimensional array into enum
Reply
#8

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
you can't set multidimensional array into enum
Wrong, it's possible.

Here there are 3 dimensions in this array :
pawn Код:
enum pInfo
{
    Money,
    Score,
    Name[MAX_PLAYER_NAME]
}

new PlayerInfo[MAX_PLAYERS][pInfo];
Reply
#9

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
Wrong, it's possible.

Here there are 3 dimensions in this array :
pawn Код:
enum pInfo
{
    Money,
    Score,
    Name[MAX_PLAYER_NAME]
}

new PlayerInfo[MAX_PLAYERS][pInfo];
it is not possible, this example is not multidimensional array inside enum

Looks like you don't know what multidimensional array is.

Array[] -> single dimension
Array[][]...[] -> multidimensional

Inside enum you can have single dimension array (Array[]), Array[][] is not acceptable
Reply
#10

Quote:
Originally Posted by CoaPsyFactor
Посмотреть сообщение
it is not possible, this example is not multidimensional array inside enum

Looks like you don't know what multidimensional array is.

Array[] -> single dimension
Array[][]...[] -> multidimensional

Inside enum you can have single dimension array (Array[]), Array[][] is not acceptable
Yes I know.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)