Make an array with prices saved in it. And to access the price you could do like VehPrice[listitem] or something similar.
|
enum vDealerInfo
{
DVehName[25],
DVehPrice,
DVehModel
}
new VehDetails_Sports[xxx][vDealerInfo]=
{// Name Price ModelID
{"Infernus", 100000, 411}, //0
.. // 1
..// 2
..// etc
};
new VehDetails_Bikes[xxx][vDealerInfo]=
{// Name Price ModelID
{"NRG-500", 50000, 511}, //0
.. //1
.. //2
..//etc
};
CMD:buy(playerid, params[])
{
//ifPlayerHasn'tReachedMax_OwnedVehicleLimit 0 1 2....
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_LIST, "Dealership!!", "Sports\nBikes\netc", "Select", "");
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 0)
{
if(!response) // If they clicked 'Cancel' or pressed esc
{
SendClientMessage(playerid, -1, "BitchPlease you too poor.");
}
else // Pressed ENTER
{
switch(listitem)
{
case 0:
{
for(new i = 0; i<sizeof(VehDeatails_Sports); i++)
{
format(MSG, sizeof(MSG), "%s%s - %i\n", MSG,VehDetails_Sports[i][VehName], VehDetails_Sports[i][VehPrice]);
}
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_LIST, "Sports", MSG);
}
case 1:
{
for(new i = 0; i<sizeof(VehDeatails_Bikes); i++)
{
format(MSG, sizeof(MSG), "%s%s - %i\n", MSG,VehDetails_Bikes[i][VehName], VehDetails_Bikes[i][VehPrice]);
}
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Bikes", MSG);
}
}
}
return 1; // We handled dialog, so return 1.
}
else if(dialogid == 1)//Sports
{
if(!response)
{
SendClientMessage(playerid, -1, "You aint even rich enough to read their names!");
}
else
{
//Store the Values and Show him the rest of the infos.
/*
For Example:
PlayerChosenVehicle[playerid]==VehDetails_Sports[listitem][DVehModel];
ShowPlayerDialog(SeleteColorForVehicle);
...
*/
}
}
else if(dialogid == 2)//Bikes
{
if(!response)
{
SendClientMessage(playerid, -1, "Can you even hold a stick bro?");
}
else
{
//Store the Values and Show him the rest of the infos.
}
}
return 0; // You MUST return 0 here
}
PHP код:
|