SA-MP Forums Archive
Any way to make this long dialog with strings more efficient? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Any way to make this long dialog with strings more efficient? (/showthread.php?tid=518447)



Any way to make this long dialog with strings more efficient? - Type-R - 10.06.2014

Hey, well a ran into kind of a problem, when i wanted to be able to set the prices of house in the dialog, and the dialog got pretty long at the same time. Heres what i have, but to me it seems like there has to be a more efficient way:

pawn Код:
new dialog[1000], stringg[150], stringg2[150], stringg3[150];
    format(stringg, sizeof(stringg), "Ryder's house($%i)\nVienas kambarys(BUDGET IN MOTEL)($%i)\nVienas kambarys(DENISE KAMBARYS)($%i)\n", knamas1, knamas2, knamas3);
    format(stringg2, sizeof(stringg2), "Vienas kambarys(KATIE KAMBARYS)($%i)\n2 aukstu, virtuve, salionas, miegamasis(CJ Namas)($%i)\n", knamas4, knamas7);
    format(stringg3, sizeof(stringg3), "2 aukstu didelis namas(Gaujos Namas)($%i)\n2Aukstu, 2kambariu(Colonel Furhberger Namas)($%i)\n", knamas8, knamas9);
    strcat(dialog, stringg, sizeof(stringg));
    strcat(dialog, stringg2, sizeof(stringg2));
    strcat(dialog, stringg3, sizeof(stringg3));
    ShowPlayerDialog(playerid, PNama, DIALOG_STYLE_LIST, "Vidaus Pasirinkimai",dialog,"Pakeisti", "Atgal");

Another thing, it doesnt work that well. Can anyone help?


Re: Any way to make this long dialog with strings more efficient? - KtotheYle - 10.06.2014

You could try and just format the dialog, that would shorten it I would think.