SA-MP Forums Archive
2 Questions about DIALOG_STYLE_INPUT - 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: 2 Questions about DIALOG_STYLE_INPUT (/showthread.php?tid=153241)



2 Questions about DIALOG_STYLE_INPUT - ViruZZzZ_ChiLLL - 08.06.2010

1st Question :
How can I know what the player typed in
the DIALOG_STYLE_INPUT when he response
in it, and how can I save what he wrote (DINI)

2nd Question :
How can I make sure that the player typed
5 or more characters.

Thanks.


Re: 2 Questions about DIALOG_STYLE_INPUT - Desert - 08.06.2010

When you create a dialog with the input style, what he types will be stored in the inputtext[] in the dialog callback. Then it's simple:

pawn Код:
if(dialogid == ?)
{
if(strlen(inputtext) >= 5)
{
dini_Set(file,"Example",inputtext);
}}



Re: 2 Questions about DIALOG_STYLE_INPUT - ViruZZzZ_ChiLLL - 08.06.2010

Quote:
Originally Posted by Desert
When you create a dialog with the input style, what he types will be stored in the inputtext[] in the dialog callback. Then it's simple:

pawn Код:
if(dialogid == ?)
{
if(strlen(inputtext) >= 5)
{
dini_Set(file,"Example",inputtext);
}}
Okay, thanks for that but how can I make the player only
type a specific word. Lets say Male or Female, and if he didn't
type Male or Female he will get an error message.


Re: 2 Questions about DIALOG_STYLE_INPUT - MadeMan - 08.06.2010

pawn Код:
if(strcmp(inputtext, "Male", true) == 0)
{

}
else if(strcmp(inputtext, "Female", true) == 0)
{

}
else
{
// Error message
}



Re: 2 Questions about DIALOG_STYLE_INPUT - ViruZZzZ_ChiLLL - 08.06.2010

Quote:
Originally Posted by MadeMan
pawn Код:
if(strcmp(inputtext, "Male", true) == 0)
{

}
else if(strcmp(inputtext, "Female", true) == 0)
{

}
else
{
// Error message
}
Oh, okay thanks


Re: 2 Questions about DIALOG_STYLE_INPUT - ViruZZzZ_ChiLLL - 08.06.2010

Okay, sorry for the double post
but how can I know this time
if the player didn't type a number
or IsNumeric so that I can send
another error message to the player.

Thanks.


Re: 2 Questions about DIALOG_STYLE_INPUT - Joe_ - 08.06.2010

pawn Код:
if(IsNumeric(inputtext)) return SendClientMessage(playerid, color, "Error: No numbers!)!)1010101"); // his message WAS numeric
if(!IsNumeric(inputtext)) return SendClientMessage(playerid, color, "3RR0R: N0 L3773R5!!!1011!11"); // his message WAS NOT numeric