stock Test(playerid, section)
{
if(section == 1)
{
Dialog_Show(playerid, QUIZ1, DIALOG_STYLE_LIST, "Antes que nada, їsabes de rol?"," (A) Sн\n (B) No","Seleccionar","");
}
else
{
new rand = random(sizeof(QuizQuestions)); <-- valor random de las preguntas.
CreateSpacer(playerid, 10); <-- espaciador de chat, no interfiere.
format(QAnswer[playerid], 2, "%d", strval(QuizQuestions[rand][0]));
Dialog_Show(playerid, QUIZ2, DIALOG_STYLE_LIST, QuizQuestions[rand][1], QuizQuestions[rand][2],"Seleccionar","");
SendSplitMessage(playerid, COLOR_SLATEGRAY, QuizQuestions[rand][1]); <- no interfiere
SendSplitMessage(playerid, COLOR_WHITE, QuizQuestions[rand][2]); <- no interfiere
}
return 1;
}
// ** Declarando la variable.
new bool:preguntas_test[MAX_PLAYERS][MAX_PREGUNTAS];
// ** OnPlayerConnect o en la funciуn donde reseteas las variables.
for(new x = 0; x < MAX_PREGUNTAS; x++) preguntas_test[playerid][x] = false;
// ** Funciуn
stock Test(playerid, section)
{
if(section == 1) return Dialog_Show(playerid, QUIZ1, DIALOG_STYLE_LIST, "Antes que nada, їsabes de rol?"," (A) Sн\n (B) No", "Seleccionar", "");
new rand = random(sizeof(QuizQuestions));
if(preguntas_test[playerid][rand] == true) return Test(playerid, section);
preguntas_test[playerid][rand] = true;
CreateSpacer(playerid, 10);
format(QAnswer[playerid], 2, "%d", strval(QuizQuestions[rand][0]));
Dialog_Show(playerid, QUIZ2, DIALOG_STYLE_LIST, QuizQuestions[rand][1], QuizQuestions[rand][2], "Seleccionar", "");
SendSplitMessage(playerid, COLOR_SLATEGRAY, QuizQuestions[rand][1]);
SendSplitMessage(playerid, COLOR_WHITE, QuizQuestions[rand][2]);
return 1;
}
// ** OnPlayerDisconnect
for(new x = 0; x < MAX_PREGUNTAS; x++) preguntas_test[playerid][x] = false;
|
Код:
// ** Declarando la variable.
new bool:preguntas_test[MAX_PLAYERS][MAX_PREGUNTAS];
// ** OnPlayerConnect o en la funciуn donde reseteas las variables.
for(new x = 0; x < MAX_PREGUNTAS; x++) preguntas_test[playerid][x] = false;
// ** Funciуn
stock Test(playerid, section)
{
if(section == 1) return Dialog_Show(playerid, QUIZ1, DIALOG_STYLE_LIST, "Antes que nada, їsabes de rol?"," (A) Sн\n (B) No", "Seleccionar", "");
new rand = random(sizeof(QuizQuestions));
if(preguntas_test[playerid][rand] == true) return Test(playerid, section);
preguntas_test[playerid][rand] = true;
CreateSpacer(playerid, 10);
format(QAnswer[playerid], 2, "%d", strval(QuizQuestions[rand][0]));
Dialog_Show(playerid, QUIZ2, DIALOG_STYLE_LIST, QuizQuestions[rand][1], QuizQuestions[rand][2], "Seleccionar", "");
SendSplitMessage(playerid, COLOR_SLATEGRAY, QuizQuestions[rand][1]);
SendSplitMessage(playerid, COLOR_WHITE, QuizQuestions[rand][2]);
return 1;
}
// ** OnPlayerDisconnect
for(new x = 0; x < MAX_PREGUNTAS; x++) preguntas_test[playerid][x] = false;
|