I need help in arrays
#1

Guys, i'm trying to make RP test before registering but the 3 options is the same as the question itself
here is the code
PHP код:
new RQ random(sizeof(Questions));
new 
Str[200], Str2[200];
format(Strsizeof(Str), "%s"Questions[RQ][1]);
format(Str2sizeof(Str2), 
"%s\n\
%s\n\
%s\n"
Questions[RQ][2], Questions[RQ][3], Questions[RQ][4]);
ShowPlayerDialog(playeridQuestions[RQ][0], DIALOG_STYLE_LISTStrStr2"Choose""Cancel"); 
Here is the array.
PHP код:
new Questions[][] = {
    {
QUESTION_ONE"Q. How do you RP a car acccident?""/me has an accident""/me would slightly hit the steering wheel, and blood would start oozing out of his forhead"" /me pushes the other vehicle off and drives off"},
    {
QUESTION_TWO"Q. How do you put an advertisement for selling a car?","Black Tampa with gold rings for sale""I am selling my car""Fuck the police! My sexy tampa on sale"},
    {
QUESTION_THREE"What is KoS?""Keyboard on Satalite""Kill on Sight""Kite on Sky"},
    {
QUESTION_FOUR"What does SA:MP stand for?""San Andreas Movie Player""San Andreas Multiplayer""San Andreas Microphone Pack"},
    {
QUESTION_FIVE"What is the correct use of /ad?""/ad any1 selling house""/ad Come Come buy awesome house!""/ad I'm selling my house with a backyard, call me"},
    {
QUESTION_SIX"If someone offered to buy VIP for you for IG money, What should you do?""Accept the deal""Finish him in a world war way""Screenshot it and head to the forums"},
    {
QUESTION_SEVEN"What is MG?""Meat Game: Cut Meat Into Pieces faster""Meta Gaming: Mix OOC with IC""Meet God: Meet the god and fight him till you win"}
}; 
Again, the problem is: The 3 options is same as the question itself.
What's the problem here?
Reply
#2

you start at index 1 and go up to 4, arrays always start at 0, also you even used the wrong parameters for showplayerdialog

Can u even compile??

Also, no need to define unnecessary line breaks in your strings.

Anyways, look at this:

PHP код:
new index random(sizeof(Questions));
new 
answers[CHECK HOW MUCH YOU NEED DAMN IT];
format(answerssizeof(output), "%s\n%s\n%s"Questions[index][1], Questions[index][2],Questions[index][3]);
ShowPlayerDialog(playeridDIALOG_IDDIALOG_STYLE_LISTQuestions[index][0], answers"Choose""Cancel"); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)