25.02.2019, 17:23
I got it what I am doing wrong but don't know to fix it :S
I loop through all grades and check if there is any grade that is made for (for example) rank 3.
If there is such grade(s) I add them to dialog.
But here is the problem, in OnDialogResponse, I am always checking this:
Pay attention on MafiaGrade[listitem + 1][gLevel]
As we all know, listitem will be always from 0 and up
In this case since in player's dialog are show grades for rank 3 (Light and Heavy gunner).
But they won't be executed through OnDialogResponse becouse that is listitem = 0, and listitem = 1,
and since I'm checking like this MafiaGrade[listitem + 1][gLevel] if you look in my variable,
it only first two grades will be executed through OnDialogResponse
Is there any way to fix this?
I loop through all grades and check if there is any grade that is made for (for example) rank 3.
If there is such grade(s) I add them to dialog.
PHP код:
case TEAM_MAFIA:
{
for(i = 1; i < sizeof(MafiaGrade); i++)
{
dmsg[0] = EOS;
if(MafiaGrade[i][gRank] != TeamRank[playerid])
{
continue;
}
format(dmsg, sizeof(dmsg), "\n"col_team_mafia"%s \t %d", MafiaGrade[i][gName], MafiaGrade[i][gLevel]);
strcat(string, dmsg);
gcounter++;
}
if(!gcounter)
{
SendErrorMessage(playerid, "There is no available grades for your current rank (%s).", RankName(playerid, TeamRank[playerid]));
}
else
{
ShowPlayerDialog(playerid, DIALOG_GRADE_MAFIA, DIALOG_STYLE_TABLIST_HEADERS, "Choose your grade", string, "Select", "Cancel");
}
}
PHP код:
MafiaGrade[listitem + 1][gLevel]
As we all know, listitem will be always from 0 and up
In this case since in player's dialog are show grades for rank 3 (Light and Heavy gunner).
But they won't be executed through OnDialogResponse becouse that is listitem = 0, and listitem = 1,
and since I'm checking like this MafiaGrade[listitem + 1][gLevel] if you look in my variable,
it only first two grades will be executed through OnDialogResponse
PHP код:
new MafiaGrade[][GradeInfo] =
{
{ -1, -1, "None", 0.0, 0.0}, // Blank row that fixes some variables. (Add new levels below this row)
{ 1, DEFAULT_LEVEL, "Junior Associate", 99.0, 0.0 }, // listitem = 0
{ 1, 3, "Senior Associate", 99.0, 0.0 }, // listitem = 1
{ 2, 3, "Newbie Crook", 99.0, 0.0 },
{ 2, 44, "Experienced Crook", 99.0, 0.0 },
{ 3, 22, "Light Gunner", 99.0, 0.0 },
{ 3, 11, "Heavy Gunner", 99.0, 0.0 }
};