Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Version 3.0.0 inputtext limitation #7

Closed
ZantetsukenGT opened this issue Aug 23, 2022 · 4 comments · Fixed by #8
Closed

Version 3.0.0 inputtext limitation #7

ZantetsukenGT opened this issue Aug 23, 2022 · 4 comments · Fixed by #8

Comments

@ZantetsukenGT
Copy link
Contributor

ZantetsukenGT commented Aug 23, 2022

I'm currently having an issue when I updated to the latest version, in which I need the inputtext string in the response function but I'm unable to obtain it, this is probably a limitation due to how callbacks work.

You're already storing all the info in arrays, so I suggest adding an API to pass in a buffer and get the text from the selected listitem, i cannot think however of an easy way of limiting its usage only within a positive response:

stock GetDialogInputText(playerid, listitem, inputtext[])
//or
stock DP_GetInputText(playerid, listitem, inputtext[])
//or
stock PagesGetInputText(playerid, listitem, inputtext[])
//or
stock DialogPagesGetInputText(playerid, listitem, inputtext[])
//or any really
stock GetInputTextDialogPages(playerid, listitem, inputtext[])

It is your call, but if there's actually a way to get the text, please let me know

@Nickk888SAMP
Copy link
Owner

You want to obtain the "inputtext" from the dialog right? The text from DIALOG_STYLE_INPUT? If so, the library isn't designed for that, only lists.

Or do you mean getting the list items string? In that case it isn't that difficult as you mentioned it's already saved in the array.

@ZantetsukenGT
Copy link
Contributor Author

Only the selected item's text.
From the samp docs:

inputtext[] - The text entered into the input box by the player or the selected list item text.

@Nickk888SAMP
Copy link
Owner

Oh well, it also returns the selected item inside inputtext? The more you know! Didn't know that! I'll look into this and will push an update soon :)

@ZantetsukenGT
Copy link
Contributor Author

I think it may be easier than I thought, for some reason I thought CallLocalFunction didn't support passing in strings.

From the samp docs:

forward publicFunc(number, Float:flt, const string[]);
public publicFunc(number, Float:flt, const string[])
{
    printf("Received integer %i, float %f, string %s", number, flt, string);
    return 1;
}

CallLocalFunction("publicFunc", "ifs", 420, 68.999999999, "Hello world");

Just pass in the inputtext variable with an s specifier here, that's the exact feature I'm looking for, and no need for extra API's.

I'll do that myself in a new PR to save you some time.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants