05.05.2017, 15:34
Hello! I'm making a server but I have a problem. How can I check if a string (inputtext) exists in an array? I have tried this but it's not working:
PHP код:
new cityWords[][] = { //Beta
"Shiopross City",
"Cuacaster City",
"Dine City",
"Looton City"
};
if(dialogid == DIALOG_QUIZ_2)
{
if(response)
{
for(new i; i < sizeof(cityWords); i++)
{
if(!strcmp(inputtext, cityWords[i], true))
{
SendClientMessage(playerid, -1, "You found one of the hidden cities!");
GivePlayerMoney(playerid, 10000);
break;
}
else if(i == 5)
{
SendClientMessage(playerid, -1, "This hidden city doesn't exist. Try again!");
ShowPlayerDialog(playerid, DIALOG_QUIZ_2, DIALOG_STYLE_INPUT, "Hidden City", "Find one of the hidden cities and win a prize!", "OK", "Cancel");
break;
}
}
}
return 1;
}