Dialog list - how do find the next value?
#1

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.
Reply
#2

If you remove car 3 from the ShowPlayerDialog function, you will only have 3 options to choose, and they will go 0,1,2
Reply
#3

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.
Reply
#4

do u have on the end of each ShowPlayerDialog the "Previous" , "Next"); ?
Reply
#5

Quote:
Originally Posted by ItzRbj
Посмотреть сообщение
do u have on the end of each ShowPlayerDialog the "Previous" , "Next"); ?
This has no relevance to my situation.
Reply
#6

Set the removed car ID to -1 then reassign all the ids, skipping the -1. That's all I could come up with currently.
Reply
#7

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.
Reply
#8

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
Reply
#9

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.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)