Dialog list - how do find the next value? -
Kebab- - 05.11.2014
Hello, I'm facing an issue at this moment. I've got a dialog as following:
Car 1 - lisitem = 0
Car 2 - listitem = 1
Car 3 - listitem = 2
Car 4 - listitem = 3
If I was to get rid of Car 3 then it would look like this:
Car 1 - lisitem = 0
Car 2 - listitem = 1
Car 4 - listitem = 3
Therefore if I was click the 3rd button on the dialog (listitem 2), it wouldn't display me any information and Car 4 wouldn't be available, because there will only be 3 buttons.
Thanks.
Re: Dialog list - how do find the next value? -
dominik523 - 05.11.2014
If you remove car 3 from the ShowPlayerDialog function, you will only have 3 options to choose, and they will go 0,1,2
Re: Dialog list - how do find the next value? -
Kebab- - 05.11.2014
Quote:
Originally Posted by dominik523
If you remove car 3 from the ShowPlayerDialog function, you will only have 3 options to choose, and they will go 0,1,2
|
Yes, but the point is that the actual listitem IDs won't change for the cars....The cars have assigned listitem IDs. So if listitem ID 0 selected it goes to Car 1 and if listitem ID 3 select it goes to car 4.
Re: Dialog list - how do find the next value? -
ItzRbj - 05.11.2014
do u have on the end of each ShowPlayerDialog the "Previous" , "Next"); ?
Re: Dialog list - how do find the next value? -
Kebab- - 05.11.2014
Quote:
Originally Posted by ItzRbj
do u have on the end of each ShowPlayerDialog the "Previous" , "Next"); ?
|
This has no relevance to my situation.
Re: Dialog list - how do find the next value? -
SKAzini - 05.11.2014
Set the removed car ID to -1 then reassign all the ids, skipping the -1. That's all I could come up with currently.
Re: Dialog list - how do find the next value? -
Kebab- - 05.11.2014
Quote:
Originally Posted by SKAzini
Set the removed car ID to -1 then reassign all the ids, skipping the -1. That's all I could come up with currently.
|
Reassigning all of the IDs is not a choice. It's MySQL based the server. It would be a pain.
AW: Dialog list - how do find the next value? -
Nero_3D - 05.11.2014
extract the number from the inputtext with sscanf (inputtext contains the selected line)
pawn Код:
// OnPlayerDialogResponse
new carid;
// if your text is "Car <carid>" than we just need to extract at the 4 character the id
if(sscanf(inputtext[4], "i", carid)) {
return print("This should never be printed!");
}
// your code
Re: AW: Dialog list - how do find the next value? -
Kebab- - 05.11.2014
Quote:
Originally Posted by Nero_3D
extract the number from the inputtext with sscanf (inputtext contains the selected line)
pawn Код:
// OnPlayerDialogResponse
new carid; // if your text is "Car <carid>" than we just need to extract at the 4 character the id if(sscanf(inputtext[4], "i", carid)) { return print("This should never be printed!"); } // your code
|
I'm talking about a list of all the Car's, not an input method. It's a small number of vehicles that will be displayed that meet certain requirements. I want it to be user friendly. I'll be using DIALOG_STYLE_LIST.
AW: Re: AW: Dialog list - how do find the next value? -
Nero_3D - 05.11.2014
Quote:
Originally Posted by Kebab-
I'm talking about a list of all the Car's, not an input method. It's a small number of vehicles that will be displayed that meet certain requirements. I want it to be user friendly. I'll be using DIALOG_STYLE_LIST.
|
Well than you didn't understood me, with (inputtext contains the selected line), let me quote the wiki
Quote:
Originally Posted by sa-mp wiki
inputtext[] - The text entered into the input box by the player or the selected list item text.
|
Means if you select from your list the third item (listitem = 2)
Car 1 - lisitem = 0
Car 2 - listitem = 1
Car 4 - listitem = 2
than inputtext would contain "Car 4", you could use that text to extract the number with sscanf