SA-MP Forums Archive
Enum help. - 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: Enum help. (/showthread.php?tid=547144)



Enum help. - BrianHarrisHun - 20.11.2014

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


Re: Enum help. - UltraScripter - 20.11.2014

show the code that have the error's


Re: Enum help. - AIped - 20.11.2014

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


Re: Enum help. - FunnyBear - 20.11.2014

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


Re : Enum help. - Dutheil - 20.11.2014

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


Re: Enum help. - daniscape - 21.11.2014

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


Re: Enum help. - CoaPsyFactor - 21.11.2014

you can't set multidimensional array into enum


Re : Re: Enum help. - Dutheil - 21.11.2014

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



Re: Re : Re: Enum help. - CoaPsyFactor - 21.11.2014

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


Re : Re: Re : Re: Enum help. - Dutheil - 21.11.2014

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.