10.10.2012, 19:51
Quote:
Код:
if(modelid == id) { GivePlayerMoney(playerid, -price); } Код:
if(modelid == id || modelid == id) { GivePlayerMoney(playerid, -price); } |
You should create an array to store all the vehicle prices, it should probably look something like this:
pawn Код:
new gVehiclePrices[] = {
50000, // Landstalker (400)
45000, // Bravura (401)
...
};
pawn Код:
new gVehiclesList[][] = {
{400, 50000}, // Landstalker to cost 50k
...
{609, 70000} // Boxville to cost 70k
}
But to formulate a list of buyable vehicles into a dialog, you could come up with something like this:
pawn Код:
new dialog_content[1024],
temp[64];
for(new i = 0; i != sizeof(gVehiclesList); i++)
{
// Format the line (for example "Boxville - $70000" with a newline ending)
format(temp, sizeof(temp), "%s - $%d\n", gVehiclesList[i][0], gVehiclesList[i][1]);
// And append the newly-formatted line to the whole dialog content
strcat(dialog_content, temp);
}
// Now display the content. Also consider adding pages or categories to this.