Can someone show me how to use input text style dialogs to find a player and store them in a variable.
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;
}
pawn Код:
new Player;
if( !sscanf( inputtext, "u", Player ) )
{
}
else
{
SendClientMessage( playerid, 0xFFFFFFFF, "Invalid Player ID." );
}