Input text
-
Hi.
How i can create input text ?
Thanks for answers.
-
@Reveres please explain more and clearly, information you provided is not enough for us to understand what you want.
-
@FoxtrotDelta I am guessing they want to know how to get input from the player using the on-screen input box, like Map-Editor does when you search for something. I've never done it so I don't know the answer...
I'm waiting for someone that does, so I can learn as well.
Or if nobody replies, I'll find out and post back here, whichever comes first.
-
@Reveres Here's one way you can do it.
int maxInputLength = 20; var inputText = Game.GetUserInput(maxInputLength);
That will create a small box in the middle of the screen where you can enter a message.
The maximum length of that message is anything up to 60 characters.What the user types is returned in the
inputText
variable but that variable can be called anything you like.Edit: Deleted that line because I was going off the default window title.
-
To get input from user.
string got = Game.GetUserInput(7);7 is amount of charcters
-
Just to add to what myself and @aimless have posted...
The input box has a maximum number of characters on a single line of 68. If you choose a number higher than 68, the box will have more lines.
So if you did:
var inputText = Game.GetUserInput(255);
You would get a box that is 68 characters wide and 4 lines high.
Game.GetUserInput()
also has 4 overloads, that let you set the WindowTitle and DefaultText properties, as well as the maxLength.
-
If you're not using ScriptHookVDotNet,
using namespace GTA::Natives::Gameplay;
DISPLAY_ONSCREEN_KEYBOARD(true, "titleText(gxtLabelOnly)", "", "prePresentText", "", "", "", maxChars + 1);
while (UPDATE_ONSCREEN_KEYBOARD() == 0)
{
WAIT(0);
}
if (UPDATE_ONSCREEN_KEYBOARD() == 2)
{
result = "If ESC is pressed";
}result = GET_ONSCREEN_KEYBOARD_RESULT();
-
Yup it is what i'm looking for.
PS.: How can I change position of "on-screen input box" ?Sorry for my bad english
-
@Reveres You can't change the position as far as I can tell, it always appears in the middle of the screen.
Your English is fine, you never have to apologise for that.
-
Ok thanks
-
You can make a custom input box from scratch if you want it at a different position, but the default gta one is in the middle.