Getting string from inputtext
#1

Hi all, as I know I can use LIST dialog type as a inputtext when player response. So how I can get player names string on this example?

Reply
#2

Extracting data from inputtext of a list-type dialog is not safe. Players can modify the inputtext you get as response. It's not recommended unless you plan on saving the content shown in dialog first and then comparing it with the corresponding list's data. Anyway, sticking to what you've asked for - you can use sscanf with it's quiet-mode to extract the name only.
pawn Code:
new tmpName[MAX_PLAYER_NAME + 1];
inputtext[1] = ' '; //Assuming your inputtext will be from each line only. Replacing '.' to ' ' (space) to make it use for current version of sscanf.
sscanf(inputtext, "?<SSCANF_QUIET=1>{d}s[25]'\t'{s}", tmpName);
//tmpName now holds the name.
Reply
#3

Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)