Variable to start from 1? -
masuzaron - 24.02.2019
PHP код:
new MafiaRank[][SomeInfo] =
{
{ blabla, blabla, blabla }, // MafiaRank[0][SomeInfo]
{ blabla, blabla, blabla }, // MafiaRank[1][SomeInfo]
{ blabla, blabla, blabla }, // ...
{ blabla, blabla, blabla }, // ...
{ blabla, blabla, blabla } // ...
};
Is there any way to make this variable to start with MafiaRank[1][SomeInfo] insted of MafiaRank[0][SomeInfo] ??
Re: Variable to start from 1? -
Banditul18 - 24.02.2019
No. This how arrays work. But you can introduce dummy info in the index 0 and use it from 1
Re: Variable to start from 1? -
masuzaron - 24.02.2019
Okay, and how to change loop than to skip that dummy field?
PHP код:
for(i = 0; i < sizeof(MafiaRank); i++)
Re: Variable to start from 1? -
Banditul18 - 24.02.2019
Start i from 1 not 0
Re: Variable to start from 1? -
TheToretto - 24.02.2019
pawn Код:
for(i = 0; i < sizeof(MafiaRank); i++)
{
if(MafiaRank[i] == 0) continue;
}
Re: Variable to start from 1? -
masuzaron - 24.02.2019
Thee is another problem, when I loop through all ranks, and skip this dummy and add other ranks in the dialog list, dialog starts from case 0: I need it to start from case 1: too, any suggestions?
Re: Variable to start from 1? -
TheToretto - 24.02.2019
Why do you need it for that too..? If you insist the only way to do it is to create an empty listitem, then it would count as 0.
Re: Variable to start from 1? -
Pottus - 24.02.2019
This is why you use #define.....
#define MAFIA_RANK_1 0
#define MAFIA_RANK_2 1
etc
Re: Variable to start from 1? -
TheToretto - 24.02.2019
Quote:
Originally Posted by TheToretto
Why do you need it for that too..? If you insist the only way to do it is to create an empty listitem, then it would count as 0.
|
My bad, I thought you were asking about listitem parameter OnDialogResponse, either use #define as Pottus said, or use an enum.
Код:
enum
{
MAFIA_RANK_1 = 1,
MAFIA_RANK_2,
MAFIA_RANK_3
}
Rank 2 will get value 2, 3 : 3 etc.
Re: Variable to start from 1? -
coool - 24.02.2019
? Just above the code where you want to start lisitems from 1... Am I right?