SA-MP Forums Archive
Fast help with inputtext[Repp +] - 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)
+--- Thread: Fast help with inputtext[Repp +] (/showthread.php?tid=614664)



Fast help with inputtext[Repp +] - ThatFag - 10.08.2016

hey guys
i was curious on how can i know if player has written the required thing
for example
Код:
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Test","Write\nHi down on box","Ok","Cancel");
So on the dialogid 2 how can i get if player has written "Hi" ??
Thanks for help in advance


Re: Fast help with inputtext[Repp +] - JaKe Elite - 10.08.2016

Use OnDialogResponse.

Click here for more information about OnDialogResponse.

You may use the parameter; inputtext (which is the field you are talking about). And to check if the player presses the left or right button, Use response (if response returns 1, It means the player pressed the left button, if it is null (zero) they pressed the right button)

Here's an example for you.

PHP код:
public OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/mycommand"true) == 0)
    {
        
ShowPlayerDialog(playerid7DIALOG_STYLE_INPUTTEXT"Server Dialog""Type something in the field please""Left""Right");
        return 
1;
    }
    return 
0;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
7:
        {
            if(
response// Player presses the left button (it returned one)
            
{
                
SendClientMessage(playerid, -1"You have typed something on the field.");
                if(
strcmp(inputtext"hi"true) == 0// Checks if the inputtext returns the word; hi
                
{
                    
SendClientMessage(playerid, -1"Hi there!");
                }
            }
            else 
// Otherwise, they pressed the right one (null)
            
{
                
SendClientMessage(playerid, -1"You have decided to close the dialog.");
            }
        }
    }
    return 
1;




Re: Fast help with inputtext[Repp +] - Shinja - 10.08.2016

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    if(
dialogid == 2)
    {
        if(!
response// Wrote nothing
        
if(!strcmp("Hi"inputtext)) //have wrote Hi
        //Have wrote something else
    
}
 
    return 
0;




Re: Fast help with inputtext[Repp +] - ThatFag - 10.08.2016

Thank you.You gave me all i needed

Repped +1