How should you go to the enum?? -
Swankeh - 10.10.2017
For example I have a limit of 20 members per faction as you can see I put them like this.
PHP код:
enum ENUM_FACCION_DATA
{
fMiembro_1[MAX_PLAYER_NAME],
fMiembro_2[MAX_PLAYER_NAME],
fMiembro_3[MAX_PLAYER_NAME],
fMiembro_4[MAX_PLAYER_NAME],
fMiembro_5[MAX_PLAYER_NAME],
fMiembro_6[MAX_PLAYER_NAME],
};
new Faccion[MAX_FACCIONES][ENUM_FACCION_DATA];
But for me it is easier for me this way because I will occupy loops
PHP код:
enum ENUM_FACCION_DATA
{
fMiembro[6][MAX_PLAYER_NAME],
};
new Faccion[MAX_FACCIONES][ENUM_FACCION_DATA];
PHP код:
enum ENUM_FACCION_DATA
{
fMiembro[MAX_PLAYER_NAME][6],
};
new Faccion[MAX_FACCIONES][ENUM_FACCION_DATA];
What I do not know is that if the MAX_PLAYER_NAME goes first or if the number of members goes first
Re: How should you go to the enum?? -
Xeon™ - 10.10.2017
a single variable (1st example) is executing much faster than array variable (2nd & 3rd example), i'd go for 2nd because of presentation
Readability is more important than speed.
Re: How should you go to the enum?? -
Swankeh - 10.10.2017
Quote:
Originally Posted by Xeon™
a single variable (1st example) is executing much faster than array variable (2nd & 3rd example), i'd go for 2nd because of presentation
Readability is more important than speed.
|
Thanks for answering. In that you are right and I would occupy the second example because I will do a loop and in the second example you can do and in the first not. But compiling me throws the error.
PHP код:
C:\Users\alexis\Desktop\Server\filterscripts\facciones5.pwn(53) : error 001: expected token: "}", but found "["
C:\Users\alexis\Desktop\Server\filterscripts\facciones5.pwn(54) : error 010: invalid function or declaration
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.
Look for solution to put the multidimensional array and found this, you think that is the correct way to solve it?
https://sampforum.blast.hk/showthread.php?tid=611504
EDIT: I use it but it does not show me the values as I want, I will look for another way to do it, thanks for explaining the speed I did not know about it, I will give you
+rep for your help.
Re: How should you go to the enum?? -
Kyle - 11.10.2017
As far as I know you cannot have a 4d array.
Rather than saving all player names I would personally save whatever fraction ID they are part.
When searching for members loop through the players and check if the fractionids match the fraction id the player is part of.
If they both match = they're part of that fraction.
Re: How should you go to the enum?? -
Hiddos - 12.10.2017
Quote:
Originally Posted by Xeon™
a single variable (1st example) is executing much faster than array variable (2nd & 3rd example)
|
what do you base this on?
OT: Don't go for your 3rd idea, it's a big hassle because you make 24 strings all sized 6 characters long, which seems not what you want to do. The second would be the most logical, because you can loop through the array to access all elements without having to hard code 1/2/3/4/5/6 every time you need it.