OnDialogResponse - list - inputtext
#1

Hello.
I am having a very annoying issue, that makes few features of my script just impossible. So, without further ado, I'll just show you what I mean.
I've got some dynamic things in my script, and when player uses "/things", it displays a ShowPlayerDialog list like this:
Код:
UID	Thing desc.
22	Small thingie
232	Very big thing, this is kinda long, but not too much and it should work goddamit!
At OnDialogResponse I use this:
Код:
switch( dialogid )
{
	case DIALOGID_LIST:
	{
		if( !response )
			return 1;

		new
			thingUID = strval( inputtext ),
			thingInfo[ 200 ]
		;

		// When player clicks on any listitem, the chosen item text is being stored into inputtext[ ].
		// As you may see, I am getting a UID variable from this text.

		format( thingInfo, 200, "Thing UID: %d\nThing description: %s",
		thingUID, Thing[ thingUID ][ thingDesc ] );

		ShowPlayerDialog( playerid, DIALOGID_INFO, DIALOG_STYLE_MSGBOX, "Thingies",
		thingInfo, "Back", "" );
	}
}
It works fine for the first item, because the listitem text is pretty short. After choosing it, you can see the small dialog window with text:
Код:
Thing UID: 22
Thing description: Small thingie
But, when player chooses the second item ("Very big thing..."), window text looks like this:
Код:
Thing UID: 0
Thing description:
So, when the listitem text is longer than some amount of characters, it is not stored in inputtext.
Is there any way to fix this?
Thanks for reading the topic. Help, please.
Reply
#2

Wait wait wait. You want to get inputtext[] from DIALOG_STYLE_LIST?
Reply
#3

@Dimi
in a list inputtext is the name of the listitem.
Reply
#4

Right. And I am getting a value from this inputtext. But the problem is, when list name is too long, inputtext becomes empty...
Reply
#5

try to print() the content of inputtext. If there's anything before the number, the strval() will return 0. There's a chance you put some unnecessary character between list items.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)