06.06.2011, 09:10
(
Last edited by woaha; 06/06/2011 at 05:51 PM.
)
I am working for while this function, wich loads dialog list contents from file, however I didin't never find a way to do so, so I tryed DLDiag from https://sampforum.blast.hk/showthread.php?tid=190068. But now I can't even see dialog!
First, I loaded contents of file with this:
Yeah they loaded fine, tested it.
Now I am creating dialog with that DLDiag.
(format should be look like this ID. QUESTION)
And now I am callin' this CreateCarSchoolDialog(playerid) from:
Others listitems works fine. But this "CreateCarSchoolDialog(playerid);" one just doesn't.
So what can be problem? Or is there simpler way to load dialog list items from file?
----
Yeah and question file should look like this:
1,What is general speed limit?
2,What is....
ID,QUESTION
BTW I am 100% sure that if (ppInfo[playerid][driving] == 0) works, so that is not the problem! (Tested it)
First, I loaded contents of file with this:
pawn Code:
#define FILESTRING_SIZE 276 // Filestring size
#define MAX_QUESTIONS 11 // Max Questions
//----------------------------------------------------------
// Question enum
//----------------------------------------------------------
enum questione
{
qid,
question[255],
answer[255]
};
new questions[MAX_QUESTIONS][questione];
stock LoadCarSchoolQuestions()
{
new filestring[FILESTRING_SIZE];
format(pfile, sizeof(pfile), "%s/%s/%s%s", CORE_FOLDER, QUESTION_FOLDER, SUB_FILE_questions, CORE_FOLDERS_FILESYSTEM);
new SplitDiv[2][MAX_QUESTIONS];
new File: file = fopen(pfile, io_read);
for(new qide = 0; qide < MAX_QUESTIONS; qide++)
{
fread(file, filestring);
split(filestring, SplitDiv, ',');
questions[qide][qid] = strval(SplitDiv[0]);
strmid(questions[qide][question], SplitDiv[1], 0, strlen(SplitDiv[1]), 255);
}
fclose(file);
return 1;
}
Now I am creating dialog with that DLDiag.
pawn Code:
stock CreateCarSchoolDialog(playerid)
{
new str[255];
for(new qide = 0; qide < MAX_QUESTIONS; qide++)
{
format(str, sizeof(str), "%i. %s", questions[qide][question], questions[qide][qid]);
AddDListItem(playerid, str, questions[qide][qid]);
}
ShowPlayerDList(playerid, 9053+1742, "Car school Questions", "Choose", "Exit");
return 1;
}
And now I am callin' this CreateCarSchoolDialog(playerid) from:
pawn Code:
// Lisence driving...
if(dialogid == 1555+1122)
{
if(response)
{
if(listitem == 0)
{
if (ppInfo[playerid][driving] == 1)
{
....
}
if (ppInfo[playerid][driving] == 0)
{
...
CreateCarSchoolDialog(playerid); // THIS WONT SHOW DIALOG????
}
}
if(listitem == 1)
{
if (ppInfo[playerid][driving] == 0)
{
...
}
if (ppInfo[playerid][driving] == 1)
{
...
}
}
}
return 1;
}
So what can be problem? Or is there simpler way to load dialog list items from file?
----
Yeah and question file should look like this:
1,What is general speed limit?
2,What is....
ID,QUESTION
BTW I am 100% sure that if (ppInfo[playerid][driving] == 0) works, so that is not the problem! (Tested it)