MySQL Selection
#1

Hello, I want to make a command to display a dialog (DIALOG_STYLE_LIST), it lists all the created houses in the server, the houses system is based on MySQL database, anyway, I know how to list the houses, but my question is that if someone chooses a house, I want to display him a dialog: Remove House, Edit House Price. So how to know which house did he choose?
Reply
#2

https://sampwiki.blast.hk/wiki/OnDialogResponse

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

You can compare the inputtext, which would be the text of the selected list item as described on the wiki. Or you could use listitem, and add it up to the number of the page multiplied by the results per page.

If you want the easy way in, then go for the first option.
Reply
#3

Quote:
Originally Posted by SickAttack
View Post
https://sampwiki.blast.hk/wiki/OnDialogResponse

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

You can compare the inputtext, which would be the text of the selected list item as described on the wiki. Or you could use listitem, and add it up to the number of the page multiplied by the results per page.

If you want the easy way in, then go for the first option.
If I make a list dialog, first option is Hai and 2nd is Bai.

If he chooses the 2nd option, the inputtext will be "Bai"?
Reply
#4

Quote:
Originally Posted by Ahmed21
View Post
If I make a list dialog, first option is Hai and 2nd is Bai.

If he chooses the 2nd option, the inputtext will be "Bai"?
Exactly.
Reply
#5

Quote:
Originally Posted by SickAttack
View Post
Exactly.
Actually it will be "listitem Bai"

I've just tested this, didn't know about it lol, Thanks for info SickAttack. : o
Reply
#6

Quote:
Originally Posted by jlalt
View Post
Actually it will be "listitem Bai"

I've just tested this, didn't know about it lol, Thanks for info SickAttack. : o
No, it's just "Bai".

pawn Code:
public OnPlayerConnect(playerid)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "1", "a\nb\nc", "1", "2");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    printf("%s", inputtext);
    return 1;
}
Reply
#7

Quote:
Originally Posted by SickAttack
View Post
No, it's just "Bai".

pawn Code:
public OnPlayerConnect(playerid)
{
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Server Rules", "a\nb\nc", "Yes", "No");
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    printf("%s", inputtext);
    return 1;
}
oh, yea you're correct lol I forgot I put listitem word in the print function lol.
Reply
#8

So the dialog is like this:
House ID : House Title
0: The cute house
1: Great houzzy
2: lolBb
3: AmmuHouse

Should I do this at the response?

PHP Code:
for(new 0MAX_HOUSESi++)
{
     new 
ChosenHouse = -1;
     if(
hInfo[i][hID] == hInfo[strval(inputtext[0..3])][hID])
     {
          
ChosenHouse i;
     }

Reply
#9

You could do that, or you could put the house ID first and get it directly. Or you could do the second option I described above. It's up to you, really.
Reply
#10

Okay thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)