PDA

View Full Version : Long dialog.


The__
03/08/2012, 08:09 AM
Hello, I'm using this dialog :

new vehdiag[1024];
strcat(vehdiag, "{33CCFF}BMX{FFFFFF} [{245E0B}$750{FFFFFF}] [{00006B}481{FFFFFF}], {33CCFF}Faggio{FFFFFF} [{245E0B}$5,600{FFFFFF}] [{00006B}462{FFFFFF}], {33CCFF}Freeway{FFFFFF} [{245E0B}$13,000{FFFFFF}] [{00006B}463{FFFFFF}], {33CCFF}Wayfarer{FFFFFF} [{245E0B}$12,000{FFFFFF}] [{00006B}589{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Walton{FFFFFF} [{245E0B}$18,000{FFFFFF}] [{00006B}478{FFFFFF}], {33CCFF}Tractor{FFFFFF} [{245E0B}$5,500{FFFFFF}] [{00006B}531{FFFFFF}], {33CCFF}Mower{FFFFFF} [{245E0B}$5,000{FFFFFF}] [{00006B}572{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Sanchez{FFFFFF} [{245E0B}$16,000{FFFFFF}] [{00006B}468{FFFFFF}], {33CCFF}PCJ-600{FFFFFF} [{245E0B}$24,000{FFFFFF}] [{00006B}461{FFFFFF}], {33CCFF}Majestic{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}517{FFFFFF}], {33CCFF}Tahoma{FFFFFF} [{245E0B}$32,000{FFFFFF}] [{00006B}566{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Picador{FFFFFF} [{245E0B}$29,000{FFFFFF}] [{00006B}600{FFFFFF}], {33CCFF}Voodoo{FFFFFF} [{245E0B}$34,000{FFFFFF}] [{00006B}412{FFFFFF}], {33CCFF}Sabre{FFFFFF} [{245E0B}$90,000{FFFFFF}] [{00006B}475{FFFFFF}], {33CCFF}Buccaneer{FFFFFF} [{245E0B}$36,000{FFFFFF}] [{00006B}518{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Bobcat{FFFFFF} [{245E0B}$32,000{FFFFFF}] [{00006B}422{FFFFFF}], {33CCFF}Mesa{FFFFFF} [{245E0B}$37,000{FFFFFF}] [{00006B}500{FFFFFF}], {33CCFF}Tornado{FFFFFF} [{245E0B}$34,000{FFFFFF}] [{00006B}576{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Hermes{FFFFFF} [{245E0B}$38,000{FFFFFF}] [{00006B}474{FFFFFF}], {33CCFF}Greenwood{FFFFFF} [{245E0B}$35,000{FFFFFF}] [{00006B}492{FFFFFF}], {33CCFF}Blade{FFFFFF} [{245E0B}$32,000{FFFFFF}] [{00006B}536{FFFFFF}], {33CCFF}Merit{FFFFFF} [{245E0B}$40,000{FFFFFF}] [{00006B}551{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Feltzer{FFFFFF} [{245E0B}$42,000{FFFFFF}] [{00006B}533{FFFFFF}], {33CCFF}Sentinel{FFFFFF} [{245E0B}$41,000{FFFFFF}] [{00006B}405{FFFFFF}], {33CCFF}Stratum{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}561{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Washington{FFFFFF} [{245E0B}$49,000{FFFFFF}] [{00006B}421{FFFFFF}], {33CCFF}Broadway{FFFFFF} [{245E0B}$34,000{FFFFFF}] [{00006B}575{FFFFFF}], {33CCFF}Remmington{FFFFFF} [{245E0B}$24,000{FFFFFF}] [{00006B}534{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Sunrise{FFFFFF} [{245E0B}$43,000{FFFFFF}] [{00006B}550{FFFFFF}], {33CCFF}Burrito{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}482{FFFFFF}], {33CCFF}Glendale{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}466{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Savanna{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}567{FFFFFF}], {33CCFF}Landstalker{FFFFFF} [{245E0B}$55,000{FFFFFF}] [{00006B}400{FFFFFF}], {33CCFF}Slamvan{FFFFFF} [{245E0B}$65,000{FFFFFF}] [{00006B}535{FFFFFF}], {33CCFF}Yosemite{FFFFFF} [{245E0B}$60,000{FFFFFF}] [{00006B}554{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Admiral{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}445{FFFFFF}], {33CCFF}Virgo{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}491{FFFFFF}], {33CCFF}Stafford{FFFFFF} [{245E0B}$70,000{FFFFFF}] [{00006B}580{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Glendale Shit{FFFFFF} [{245E0B}$15,000{FFFFFF}] [{00006B}604{FFFFFF}], {33CCFF}Camper{FFFFFF} [{245E0B}$40,000{FFFFFF}] [{00006B}483{FFFFFF}], {33CCFF}FCR-900{FFFFFF} [{245E0B}$80,000{FFFFFF}] [{00006B}521{FFFFFF}], {33CCFF}Super GT{FFFFFF} [{245E0B}$125,000{FFFFFF}] [{00006B}506{FFFFFF}];\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Hustler{FFFFFF} [{245E0B}$40,000{FFFFFF}] [{00006B}545{FFFFFF}], {33CCFF}Vincent{FFFFFF} [{245E0B}$78,000{FFFFFF}] [{00006B}540{FFFFFF}], {33CCFF}Blista Compact{FFFFFF} [{245E0B}$64,000{FFFFFF}] [{00006B}496{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Regina{FFFFFF} [{245E0B}$55,000{FFFFFF}] [{00006B}479{FFFFFF}], {33CCFF}Phoenix{FFFFFF} [{245E0B}$110,000{FFFFFF}] [{00006B}603{FFFFFF}], {33CCFF}Emperor{FFFFFF} [{245E0B}$75,000{FFFFFF}] [{00006B}585{FFFFFF}], {33CCFF}Tampa{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}549{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Primo{FFFFFF} [{245E0B}$65,000{FFFFFF}] [{00006B}547{FFFFFF}], {33CCFF}Intruder{FFFFFF} [{245E0B}$55,000{FFFFFF}] [{00006B}546{FFFFFF}], {33CCFF}Willard{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}529{FFFFFF}], {33CCFF}Cadrona{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}527{FFFFFF}]\n", sizeof(vehdiag));
strcat(vehdiag, "{33CCFF}Fortune{FFFFFF} [{245E0B}$65,000{FFFFFF}] [{00006B}526{FFFFFF}], {33CCFF}Nebula{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}516{FFFFFF}], {33CCFF}Bike{FFFFFF} [{245E0B}$950{FFFFFF}] [{00006B}509{FFFFFF}], {33CCFF}Sadler{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}543{FFFFFF}]\n", sizeof(vehdiag));
ShowPlayerDialog(playerid, DIALOG_VEHICLES, DIALOG_STYLE_MSGBOX,"~ Vehicle List ~", vehdiag, "DONE","CLOSE");

Is this too long ? it doesn't display everything.

Cjgogo
03/08/2012, 08:11 AM
new vehdiag[1024]; that should be long ENOUGH

EDIT:I am sorry,I meant,show us a picture of the dialog

Cjgogo
03/08/2012, 08:15 AM
Here's the corect from of strcat...:
http://wiki.sa-mp.com/wiki/Strcat

The__
03/08/2012, 08:26 AM
http://pokit.org/get/img/f6847aaae124ee307749c8ad8fc23f91.png

Cjgogo
03/08/2012, 08:37 AM
Remove sizeof(vehdialog) from the end of every strcat instruction,take a look at the wiki STRCAT correct format :P it's strcat(string,"Message");,and you have it like: strcat(string,"Message",sizeof(string)); wich is not correct :P

Misiur
03/08/2012, 08:59 AM
It is correct, but it's already default parameter.
strcat(string,"Message") is the same as strcat(string,"Message",sizeof(string))
Max string len for 0.3e is 1023+null, and max dialog text limit is 2048. The error is somewhere else

The__
03/08/2012, 09:02 AM
same.

new vehdiag[1024];
strcat(vehdiag, "{33CCFF}BMX{FFFFFF} [{245E0B}$750{FFFFFF}] [{00006B}481{FFFFFF}], {33CCFF}Faggio{FFFFFF} [{245E0B}$5,600{FFFFFF}] [{00006B}462{FFFFFF}], {33CCFF}Freeway{FFFFFF} [{245E0B}$13,000{FFFFFF}] [{00006B}463{FFFFFF}], {33CCFF}Wayfarer{FFFFFF} [{245E0B}$12,000{FFFFFF}] [{00006B}589{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Walton{FFFFFF} [{245E0B}$18,000{FFFFFF}] [{00006B}478{FFFFFF}], {33CCFF}Tractor{FFFFFF} [{245E0B}$5,500{FFFFFF}] [{00006B}531{FFFFFF}], {33CCFF}Mower{FFFFFF} [{245E0B}$5,000{FFFFFF}] [{00006B}572{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Sanchez{FFFFFF} [{245E0B}$16,000{FFFFFF}] [{00006B}468{FFFFFF}], {33CCFF}PCJ-600{FFFFFF} [{245E0B}$24,000{FFFFFF}] [{00006B}461{FFFFFF}], {33CCFF}Majestic{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}517{FFFFFF}], {33CCFF}Tahoma{FFFFFF} [{245E0B}$32,000{FFFFFF}] [{00006B}566{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Picador{FFFFFF} [{245E0B}$29,000{FFFFFF}] [{00006B}600{FFFFFF}], {33CCFF}Voodoo{FFFFFF} [{245E0B}$34,000{FFFFFF}] [{00006B}412{FFFFFF}], {33CCFF}Sabre{FFFFFF} [{245E0B}$90,000{FFFFFF}] [{00006B}475{FFFFFF}], {33CCFF}Buccaneer{FFFFFF} [{245E0B}$36,000{FFFFFF}] [{00006B}518{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Bobcat{FFFFFF} [{245E0B}$32,000{FFFFFF}] [{00006B}422{FFFFFF}], {33CCFF}Mesa{FFFFFF} [{245E0B}$37,000{FFFFFF}] [{00006B}500{FFFFFF}], {33CCFF}Tornado{FFFFFF} [{245E0B}$34,000{FFFFFF}] [{00006B}576{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Hermes{FFFFFF} [{245E0B}$38,000{FFFFFF}] [{00006B}474{FFFFFF}], {33CCFF}Greenwood{FFFFFF} [{245E0B}$35,000{FFFFFF}] [{00006B}492{FFFFFF}], {33CCFF}Blade{FFFFFF} [{245E0B}$32,000{FFFFFF}] [{00006B}536{FFFFFF}], {33CCFF}Merit{FFFFFF} [{245E0B}$40,000{FFFFFF}] [{00006B}551{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Feltzer{FFFFFF} [{245E0B}$42,000{FFFFFF}] [{00006B}533{FFFFFF}], {33CCFF}Sentinel{FFFFFF} [{245E0B}$41,000{FFFFFF}] [{00006B}405{FFFFFF}], {33CCFF}Stratum{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}561{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Washington{FFFFFF} [{245E0B}$49,000{FFFFFF}] [{00006B}421{FFFFFF}], {33CCFF}Broadway{FFFFFF} [{245E0B}$34,000{FFFFFF}] [{00006B}575{FFFFFF}], {33CCFF}Remmington{FFFFFF} [{245E0B}$24,000{FFFFFF}] [{00006B}534{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Sunrise{FFFFFF} [{245E0B}$43,000{FFFFFF}] [{00006B}550{FFFFFF}], {33CCFF}Burrito{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}482{FFFFFF}], {33CCFF}Glendale{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}466{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Savanna{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}567{FFFFFF}], {33CCFF}Landstalker{FFFFFF} [{245E0B}$55,000{FFFFFF}] [{00006B}400{FFFFFF}], {33CCFF}Slamvan{FFFFFF} [{245E0B}$65,000{FFFFFF}] [{00006B}535{FFFFFF}], {33CCFF}Yosemite{FFFFFF} [{245E0B}$60,000{FFFFFF}] [{00006B}554{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Admiral{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}445{FFFFFF}], {33CCFF}Virgo{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}491{FFFFFF}], {33CCFF}Stafford{FFFFFF} [{245E0B}$70,000{FFFFFF}] [{00006B}580{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Glendale Shit{FFFFFF} [{245E0B}$15,000{FFFFFF}] [{00006B}604{FFFFFF}], {33CCFF}Camper{FFFFFF} [{245E0B}$40,000{FFFFFF}] [{00006B}483{FFFFFF}], {33CCFF}FCR-900{FFFFFF} [{245E0B}$80,000{FFFFFF}] [{00006B}521{FFFFFF}], {33CCFF}Super GT{FFFFFF} [{245E0B}$125,000{FFFFFF}] [{00006B}506{FFFFFF}];\n");
strcat(vehdiag, "{33CCFF}Hustler{FFFFFF} [{245E0B}$40,000{FFFFFF}] [{00006B}545{FFFFFF}], {33CCFF}Vincent{FFFFFF} [{245E0B}$78,000{FFFFFF}] [{00006B}540{FFFFFF}], {33CCFF}Blista Compact{FFFFFF} [{245E0B}$64,000{FFFFFF}] [{00006B}496{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Regina{FFFFFF} [{245E0B}$55,000{FFFFFF}] [{00006B}479{FFFFFF}], {33CCFF}Phoenix{FFFFFF} [{245E0B}$110,000{FFFFFF}] [{00006B}603{FFFFFF}], {33CCFF}Emperor{FFFFFF} [{245E0B}$75,000{FFFFFF}] [{00006B}585{FFFFFF}], {33CCFF}Tampa{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}549{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Primo{FFFFFF} [{245E0B}$65,000{FFFFFF}] [{00006B}547{FFFFFF}], {33CCFF}Intruder{FFFFFF} [{245E0B}$55,000{FFFFFF}] [{00006B}546{FFFFFF}], {33CCFF}Willard{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}529{FFFFFF}], {33CCFF}Cadrona{FFFFFF} [{245E0B}$45,000{FFFFFF}] [{00006B}527{FFFFFF}]\n");
strcat(vehdiag, "{33CCFF}Fortune{FFFFFF} [{245E0B}$65,000{FFFFFF}] [{00006B}526{FFFFFF}], {33CCFF}Nebula{FFFFFF} [{245E0B}$50,000{FFFFFF}] [{00006B}516{FFFFFF}], {33CCFF}Bike{FFFFFF} [{245E0B}$950{FFFFFF}] [{00006B}509{FFFFFF}], {33CCFF}Sadler{FFFFFF} [{245E0B}$30,000{FFFFFF}] [{00006B}543{FFFFFF}]\n");
ShowPlayerDialog(playerid, DIALOG_VEHICLES, DIALOG_STYLE_MSGBOX,"~ Vehicle List ~", vehdiag, "DONE","CLOSE");

Misiur
03/08/2012, 09:27 AM
There's no such thing!

I feel stupid :o http://wiki.sa-mp.com/wiki/Limits - thought this was up to date. Looks like OP just needs to change 1024 to something bigger

Misiur
03/08/2012, 10:00 AM
Thank you, looks like I missed the big, bold "Textdraws" header. OP's text is ~4157 characters long. 4052+1 is the biggest string I can store in one variable without getting stack/heap error. How can we solve this? I can only think about splitting this dialog into pages

The__
03/08/2012, 11:37 AM
So...what about my problem... ?

Larceny
03/08/2012, 02:20 PM
Your string is too... too long, probably it won't show all the characters.

To show as many as possible chars increase the size of the array to:
new vehdiag[3984];

Also, it will show only until "fortune" text.

I tried with a larger array, but dialog doesn't show.

I suggest to divide the dialog in 2 parts.