SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 02/02/2017, 08:10 AM   #1
rOps
Big Clucker
 
Join Date: Apr 2014
Posts: 71
Reputation: 0
Default Getting string from inputtext

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?

rOps is offline   Reply With Quote
Old 02/02/2017, 08:31 AM   #2
Lordzy
High-roller
 
Lordzy's Avatar
 
Join Date: Mar 2012
Location: NetherRealm
Posts: 2,698
Reputation: 1177
Default Re: Getting string from inputtext

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.
__________________
Currently inactive - I don't play at any SA-MP servers nor work on anything in PAWN for now. The projects that I've done so far in PAWN, which requires updates will be taking some time.
Lordzy is offline   Reply With Quote
Old 02/02/2017, 08:44 AM   #3
rOps
Big Clucker
 
Join Date: Apr 2014
Posts: 71
Reputation: 0
Default Re: Getting string from inputtext

Thank you.
rOps is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best way to save inputtext to a string? (Variable) rangerxxll Scripting Help 1 14/11/2015 02:46 AM
[HELP] Save a string from inputtext to a variable Hayden_Almeida Scripting Help 1 10/11/2015 10:01 PM
[Ajuda] Salvar o inputtext numa variavel string Hayden_Almeida Português/Portuguese 10 10/11/2015 09:27 PM
Storing inputtext[] from DIALOG_INPUT in a string? Cena44 Scripting Help 4 08/07/2014 02:12 PM
[Question] - How to get String from inputtext xRyder Scripting Help 6 30/08/2012 07:46 PM


All times are GMT. The time now is 12:57 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.