Dialog Help
#1

Can someone show me how to use input text style dialogs to find a player and store them in a variable.
Reply
#2

wooooooow
Reply
#3

pawn Код:
#include <a_samp>
#include <sscanf2>

#define referDialog ( 13245 )

public OnPlayerConnect ( playerid )
{
    ShowPlayerDialog ( playerid, referDialog, DIALOG_STYLE_INPUT, "Referal?", "Did anyone refer you here?", "There", "Nah" );
    return 1;
}

public OnDialogResponse ( playerid, dialogid, response, listitem, inputtext [ ] )
{
    new
        rPlayer
    ;

    switch ( dialogid )
    {
        case referDialog:
        {
            if ( sscanf ( inputtext, "u", rPlayer ) ) ShowPlayerDialog ( playerid, referDialog, DIALOG_STYLE_INPUT, "Referal?", "Did anyone refer you here ?\n[ Please input someone ]", "There", "Nah" );
            else if ( rPlayer == INVALID_PLAYER_ID ) ShowPlayerDialog ( playerid, referDialog, DIALOG_STYLE_INPUT, "Referal?", "Did anyone refer you here ?\n[ Invalid player ]", "There", "Nah" );
            else
            {
                GivePlayerMoney ( rPlayer, 1337 );
                SendClientMessage ( playerid, 0xFFFFFFAA, "Thanks for referring someone." );
            }
        }
    }
    return 1;
}
Reply
#4

pawn Код:
new Player;
   
    if( !sscanf( inputtext, "u", Player ) )
    {
       
    }
    else
    {
        SendClientMessage( playerid, 0xFFFFFFFF, "Invalid Player ID." );
    }
Reply
#5

Thank you all so much! I will research sscanf.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)