05.12.2010, 10:26
Im really a beginner with dialogs, i want that when you type "/answer" a input dialog pops up, and if you write "Hannes" you get $500, if you write something else you dont get any money, and if you press cancel you get a message.
I have this, and i can compile without errors, but when i try it in game nothing happens when i press cancel or submit
I have this, and i can compile without errors, but when i try it in game nothing happens when i press cancel or submit

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/answer", true)==0)
{
ShowPlayerDialog(playerid, 3275, DIALOG_STYLE_INPUT, "What is the correct answer?", "Write the answer below:", "Submit", "Cancel");
return 1;
}
return 0;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new string[7] = "Hannes";
new str = strval(string);
if(dialogid == 3275)
{
if(response)
{
if(inputtext[playerid] == str)
{
SendClientMessage(playerid, 0xFFFFFFFF, "You won $500!");
GivePlayerMoney(playerid, 500);
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, "Wrong answer!");
}
}
if(!response) return SendClientMessage(playerid, 0xFFFFFFFF, "You canceled!");
return 1;
}
return 0;
}