Problem with MySQL/dialog.
#1

Hello.

I have a command to list the player vehicles.

pawn Код:
mysql_format(MySQLConnect, query, 256, "SELECT * FROM vehs WHERE Proprio = '%s'", NameRequete[playerid]);
mysql_tquery(MySQLConnect, query, "CarTaxi", "i", playerid);
Then the player can choose the vehicle he wants to turn it into a taxi.

But if I have 3 vehicles I select the second, it will be the third to be transformed ...

pawn Код:
forward CarTaxi(playerid);
public CarTaxi(playerid)
{
    new rows = cache_num_rows(),
        string_total[256],
        stringveh[50];

    for(new i = 1; i < rows+1; i++)
    {
        if(!IsABike(i))
        {
            format(stringveh, sizeof(stringveh), "%s\n", GetVehicleName(i));
            strins(string_total, stringveh, strlen(string_total));
            IdVehTaxi[playerid] = i;
        }
    }
    return ShowPlayerDialog(playerid, 11, DIALOG_STYLE_LIST, "Taxi:", string_total, "Ok", "Quit");
}
Reply
#2

IdVehTaxi[playerid] = The id of the selected vehicle in the dialog...

How can it be that?
Because in my loop will IdVehTaxi the last vehicle ... not the one selected in the dialog.
Reply
#3

up please...
Reply
#4

upppppppppp
Reply
#5

your loop is wrong.. you increased the variable while it shouldn't be increased, so it will select the row which is next to the row which is wanted.
Try:
pawn Код:
for(new i; i < rows; i++)
Reply


Forum Jump:


Users browsing this thread: