if(listitem == 0) { new stringzz[10000],stringy[10000]; for(new xf = 0; xf < MAX_PERSONAL_CARS; xf++) { if(Stock[xf][vType] == 1) { format(stringy, sizeof(stringy), "{ffffff}%s ( %d{33cc33}${ffffff} ) ( {00FFFF}%d {ffffff}cars in stock)\n", Stock[xf][vName], Stock[xf][vPrice], Stock[xf][vStock]); strcat(stringzz,stringy); } } ShowPlayerDialog(playerid, DIALOG_CARBUY2, DIALOG_STYLE_LIST, "Buy a car", stringzz, "Select", "Close"); }
new stringzz[10000],stringy[10000];
if(dialogid == DIALOG_CARBUY2) { if(response) { new num = listitem + 1; BuyCar[playerid] = num; if(GetPlayerCash(playerid) >= Stock[num][vPrice]) { if(Stock[num][vStock] > 0) { InsertCar(playerid,1,num); } else { new stringg[MAX_STRING]; format(stringg,sizeof(stringg),"Aceasta masina nu mai este disponibila in Dealership. Stoc epuizat.\nYou can't buy this vehicle from the dealership. Out of stock."); ShowPlayerDialog(playerid, DIALOG_NOSTOCK, DIALOG_STYLE_MSGBOX, "Out of stock", stringg, "Close",""); } } else return SendClientMessage(playerid, COLOR_GREY, "You don't have enough money to purchase this vehicle."); } return 1; }
DIALOG_CARBUY2 is not relevant.
Your issue is with your string size. You're out of space. |
#define MAX_PAGE_SHOW 30
new PlayerCarBuyPage[MAX_PLAYERS];
new CarBuySelector[MAX_PLAYERS][MAX_PAGE_SHOW+3];
stock ShowVehicleBuy(playerid, page)
{
new
str[1250],
counter = 0
;
PlayerCarBuyPage[playerid] = page;
if(page == 1)
str = "{FFFF00}List 1\n";
else
format(str, sizeof(str), "%s{FFFF00}<< List %d\n", str, page-1);
for(new i = 0; i < MAX_PERSONAL_CARS; i++)
{
if(Stock[i][vType] == 1)
{
counter++;
}
}
new
bool:toSecondPage = false,
countfind = 0
;
for(new i = page*MAX_PAGE_SHOW; i < counter; i++)
{
countfind++;
if(countfind == MAX_PAGE_SHOW+1)
{
toSecondPage = true;
break;
}
else
{
format(str, sizeof(str), "%s{ffffff}%s ( %d{33cc33}${ffffff} ) ( {00FFFF}%d {ffffff}cars in stock)\n", str, Stock[xf][vName], Stock[xf][vPrice], Stock[xf][vStock]);
CarBuySelector[playerid][countfind-1] = i;
}
}
if(toSecondPage)
format(str, sizeof(str), "%s{FFFF00}List %d >>\n", str, (page+1)+1);
ShowPlayerDialog(playerid, DIALOG_CARBUY2, DIALOG_STYLE_LIST, "Buy a car", str, "Select", "Cancel");
return 1;
}
case DIALOG_CARBUY2:
{
if(response)
{
if(listitem == 0)
{
if(PlayerCarBuyPage[playerid] == 1)
ShowVehicleBuy(playerid, 1);
else
ShowVehicleBuy(playerid, PlayerCarBuyPage[playerid]-1);
return 1;
}
if(listitem == MAX_PAGE_SHOW+1)
{
return ShowVehicleBuy(playerid, PlayerCarBuyPage[playerid]+1);
}
//To use the selected item:
new idx = CarBuySelector[playerid][listitem-1];
}
}