22.09.2012, 17:32
pawn Код:
enum quiz {
question[64],
correctAnswer[64],
wrongAnswer1[64],
wrongAnswer2[64],
wrongAnswer3[64],
};
new quizQuestions[][quiz] = {
{"How many apples?", "10", "5", "15", "20"},
// etc.
};
pawn Код:
new SelectedQuestions[20] = {-1, ...}, rand;
for(new i; i < sizeof(SelectedQuestions); i++)
{
do rand = random(sizeof(quizQuestions));
while(inArray(rand, SelectedQuestions));
SelectedQuestions[i] = rand;
}
pawn Код:
stock inArray(value, const array[], size = sizeof(array))
{
for(new i; i < size; i++)
if(array[i] == value) return true;
return false;
}