for(new k=0; k<MAX_CARS; k++) {
format(ShowDlg,sizeof(ShowDlg),"%s%s\t%d$\n",ShowDlg,HouseCarName[k],HouseCarPrice[k]);
}
ShowPlayerDialog(playerid, id, DIALOG_STYLE_LIST, "House Car", ShowDlg, "Buy", "Cancel");
Originally Posted by Joe Staff
How large is "MAX_CARS" ?
|
Originally Posted by Seif_
Quote:
|
Originally Posted by Joe Staff
The only thing I can think of that would cause that crash is the creation of ShowDlg, show us, from that line to your loop there.
|
forward ShowDialog(playerid, id);
public ShowDialog(playerid, id)
{
new ShowDlg[1024];
if(id == 1) {
// code
} else if(id == 2) {
// code > and here goes dialogs until id 11, id 11 is cars dialog
} else if(id == 11) {
for(new k=0; k<MAX_CARS; k++) {
format(ShowDlg,sizeof(ShowDlg),"%s%s - %d$\n",ShowDlg,HouseCarName[k],HouseCarPrice[k]);
}
ShowPlayerDialog(playerid, id, DIALOG_STYLE_LIST, "House Car", ShowDlg, "Buy", "Cancel");
} else if(id == 12) {
// other dialog
} else if(id == 13) {
//other dialog
}
return id;
}
Originally Posted by Seif_
Use strins like I said...
|
new InsertStr[128];
for(new k=0; k<MAX_CARS; k++) {
format(InsertStr,sizeof(InsertStr),"%s - %d$\n",HouseCarName[k],HouseCarPrice[k]);
strins(InsertStr,ShowDlg,strlen(ShowDlg));
}
ShowPlayerDialog(playerid, id, DIALOG_STYLE_LIST, "House Car", ShowDlg, "Buy", "Cancel");
new string[128];
for(new k=0; k<MAX_CARS; k++)
{
format(string,128,"%s - %d$\n",HouseCarName[k],HouseCarPrice[k]);
strins(ShowDlg,string,strlen(ShowDlg));
}
ShowPlayerDialog(playerid, id, DIALOG_STYLE_LIST, "House Car", ShowDlg, "Buy", "Cancel");
Originally Posted by Seif_
Quote:
|
format(ShowDlg, sizeof(ShowDlg), "%s - %d$", HouseCarName[0], HouseCarPrice[0]);
for(new k = 1; k < MAX_CARS; k++) {
format(ShowDlg, sizeof(ShowDlg), "%s\n%s - %d$", ShowDlg, HouseCarName[k], HouseCarPrice[k]);
}
ShowPlayerDialog(playerid, id, DIALOG_STYLE_LIST, "House Car", ShowDlg, "Buy", "Cancel");