How to put in enum number of arrays + strings?
#1

I would like to ask, I'm trying to make 6 wanted reasons for wanted level.
Instead of doing:
Код:
enum pInfo
{
    WantedReason1[24],
    WantedReason2[24],
    WantedReason3[24],
    WantedReason4[24],
    WantedReason5[24],
    WantedReason6[24],
};
I want:
Код:
enum pInfo
{
    WantedReason[6][24],
};
So later on I can do this for example:
Код:
for(new i = 0; i < 5; i++)
{
    INI_String("WantedReason",PlayerInfo[playerid][WantedReason][i], 24);
}
How can i do this to work? When i complie it like that, its working untill the variable in the enum WantedReason and everything after the variable is in error. so im asuming this is incorrect way to do it.
Reply
#2

You cannot have a 2D array in your enumerator like that, but you could declare it outside your enumerator.
Reply
#3

Quote:
Originally Posted by CalvinC
Посмотреть сообщение
You cannot have a 2D array in your enumerator like that, but you could declare it outside your enumerator.
can you show me how?
But it has to feet PlayerInfo[playerid] :/
Reply
#4

for(new i = 0; i != 6; i++) ... this will loop 6x
for(new i = 0; i != 5; i++) ... this will loop 5x

If you have 6 starts then you should loop 6x and not 5.
Reply
#5

pawn Код:
new WantedReason[MAX_PLAYERS][6][24];
I don't think it's possible to do in an enumerator, but there's no difference.
Reply
#6

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
for(new i = 0; i != 6; i++) ... this will loop 6x
for(new i = 0; i != 5; i++) ... this will loop 5x

If you have 6 starts then you should loop 6x and not 5.
Wanted can be 6 stars so its 0,1,2,3,4,5 5x. its more like i need to do [5] instead of 6

Well I guess i will go with new WantedReason[MAX_PLAYERS][6][24]; thanks..
Reply
#7

You cannot do that in an enum because pawn doesn't support 4-dimensional arrays.
PlayerInfo[playerid][WantedReason][x][y] is a 4-dimensional array.
Reply
#8

Quote:
Originally Posted by Ralfie
Посмотреть сообщение
Can you even count?

0, 1, 2, 3, 4, 5 are 6 numbers and not 5 lol.
Probably counting the arrows here could help more: http://gyazo.com/f3f7c4fa4212cbfb3e391810c4054d12
6x.. right i said 6 stars and ment to write 0,1,2,3,4,5 x6 .. dude dont insult me just help with the problem..which dont even relat to the counting.. thanks
Reply
#9

I did not even intended to insult you, i just wanted to get you on the right track and avoid flaws in your code: http://gyazo.com/d8658fb8d7a0e46908f41a69d565130a
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)