01.01.2010, 18:45
I've got a problem; I have 3 variables called age, origin, and sex.
I want to store information in them but somehow the information doesn't get stored in origin and age.
This is the code, I have no clue why it doesn't work.
I want to store information in them but somehow the information doesn't get stored in origin and age.
This is the code, I have no clue why it doesn't work.
Код:
playerAns(playerid, text[]) {
new //Variabelen, hierin worden antwoorden gestored
age,
origin[128],
sex[128]
;
//Kijken in welke vraag hij zit
switch(questions[playerid]) {
case 0: {
//Speler zit niet in vraag, melden dat hij niet kan chatten
SendClientMessage(playerid, 0xAFAFAFAA, "You are unnable to chat while you are in the tutorial");
} case 1: {
//Speler zit in een vraag, kijken of het een getal is
if(IsNumeric(text)) {
//Het is een getal, kijken of het een realistisch getal is
if(strval(text) < 100 && strval(text) >= 18) {
//Correct formaat, opslaan
RequestAns(playerid, 2);
age = strval(text);
} else {
//Geen realistische leeftijd
SendClientMessage(playerid, 0xAFAFAFAA, "You have to fill in a realistic age");
}
} else {
//Geen nummer ingevoerd
SendClientMessage(playerid, 0xAFAFAFAA, "Fill in a number please");
}
} case 2: {
//Speler is in vraag 2
format(origin, 128, "%s", text);
RequestAns(playerid, 3);
} case 3: {
//Speler is in vraag 3, kijken wat hij invulde
if(!strcmp(text, "male", true)) {
//Speler beweerd mannelijk te zijn, gegevens opslaan
format(sex, 128, "male");
SaveQuestions(playerid, age, origin, sex);
} else if(!strcmp(text, "female", true)) {
//Speelster beweerd vrouwelijk te zijn, gegevens opslaan
format(sex, 128, "female");
SaveQuestions(playerid, age, origin, sex);
} else {
//Foutieve invoer
SendClientMessage(playerid, 0xAFAFAFAA, "Incorrect input, fill in male of female");
}
}
}
}

