Help me with input
#1

Hi everyone, how can i create inputtext, that insert text someone name. On that player add's money or something else.
Reply
#2

you mean like a dialog?

Step 1: Create a dialog: https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Step 2: ondialog response:

pawn Код:
GivePlayerMoney( playerid, strval( inputtext ) );
^^ untested, but should work.
strval converts a string into an integer value, the inputtext is a string.

https://sampwiki.blast.hk/wiki/Strval
Reply
#3

Look, DIALOG_STYLE_INPUT if I enter someones online players ID, it gives him money.
Reply
#4

help. Bump
Reply
#5

Yes hello, thanks for bumping the thread after that only 30 minutes has passed.

Код:
#define DIALOG_GIVE_MOENY 50

#define DIALOG_GIVE_MONEY2 51

new targetID;

OnPlayerDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if(dialogid == DIALOG_GIVE_MONEY)
	{
		if(response)
		{
			targetID = strval(inputtext);
			if(IsPlayerConnected(targetID)
			{
				ShowPlayerDialog(playerid, DIALOG_GIVE_MONEY2, DIALOG_STYLE_INPUT, "", "Insert the amount of money you want to give to the player.", "Next", "Close");
				return 1;
			}
			else
			{
				SCM(playerid, color, "Target is not online.");
				return 1;
			}
		}
		else if(!response)
		{
			SCM(playerid, color, "Well you just suck!");
			return 1;
		}
	}
	
	if(dialogid == DIALOG_GIVE_MOENY2)
	{
		if(response)
		{
			new money = strval(inputtext);
			ResetPlayerMoney(targetid);
			GivePlayerMoney(targetid, money);
			return 1;
		}
		if(!response) return SCM(playerid, color, "You suck even more now.");
	}
}

CMD:giveMoneyToPlayer(playerid, params[])
{
	ShowPlayerDialog(playerid, DIALOG_GIVE_MONEY, DIALOG_STYLE_INPUT, "", "Insert a player ID in the box below.", "Next", "Close");
	return 1;
}
Pretty sure this won't work if two players do this command at the same time because targetID is only one. But eh' whatever, don't see why you want this in dialogs if you can get it in a simple command. -.-' Oh and if you copy and paste this won't work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)