OnDialogResponse - something wrong. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnDialogResponse - something wrong. (
/showthread.php?tid=106588)
OnDialogResponse - something wrong. -
Striker_Moe - 04.11.2009
Hi there.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 555)
{
if (!strcmp(inputtext, amount[playerid]))
{
SetPlayerChatBubble(npcid,"Thank you, Sir! Enjoy your drink.",0xFFFFFFAA,20,4000);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
return 1;
}
}
return 0;
}
The amount[playerid] is ALWAYS a digit, for example 7. Why is this not working?
Re: OnDialogResponse - something wrong. -
CracK - 04.11.2009
You are comparing string to integer.
Try:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 555)
{
new beer;
if(strlen(inputtext) < 2)
{
beer = strval(inputtext);
if (beer == amount[playerid])
{
SetPlayerChatBubble(npcid,"Thank you, Sir! Enjoy your drink.",0xFFFFFFAA,20,4000);
SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_BEER);
return 1;
}
}
}
return 0;
}
Re: OnDialogResponse - something wrong. -
Striker_Moe - 04.11.2009
Thanks man, although I get a error:
Код:
error 029: invalid expression, assumed zero
at this line:
Код:
if(beer == amount[playerid]))
//EDIT: Ah nevermind, there was one ) too much. Thank you!
Re: OnDialogResponse - something wrong. -
Correlli - 04.11.2009
Quote:
Originally Posted by Mo3
Код:
if(beer == amount[playerid]))
|
Should be:
Код:
if(beer == amount[playerid])
Re: OnDialogResponse - something wrong. -
Striker_Moe - 04.11.2009
Not working this way - nothing happens.
Re: OnDialogResponse - something wrong. -
CracK - 04.11.2009
What are you typing in the dialog box?
Re: OnDialogResponse - something wrong. -
Striker_Moe - 04.11.2009
For example "8".
Re: OnDialogResponse - something wrong. -
Striker_Moe - 04.11.2009
Nevermind Iґve used the wrong dialog ID
Thank you all.
Re: OnDialogResponse - something wrong. -
Benne - 04.11.2009
Should be:
Код:
if(beer == amount[playerid])
[/quote]
I changed this to:
if (beer == amount(playerid)) It made the error go away, I'm not sure if it works.