SA-MP Forums Archive
Line too long - 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: Line too long (/showthread.php?tid=510895)



Line too long - AphexCCFC - 03.05.2014

What's wrong with this? I put it all on one line but my pawno crashes.

pawn Код:
format(string, sizeof(string), ""White"Kitchen Sink ("Green"$%d"White")\nKitchen Sink 2 ("Green"$%d"White")\nKitchen Sink 3 ("Green"$%d"White")\nCooker ("Green"$%d"White")\nCooker 2 ("Green"$%d"White")\nWashing Machine ("Green"$%d"White")\nWashing Machine 2 ("Green"$%d"White")\n", KitSink, KitSink2, KitSink3, Cooker, Cooker2, Washer, Washer2);
            format(string, sizeof(string), "%sFridge ("Green"$%d"White")\nFryer ("Green"$%d"White")", string, Fridge, Fryer);
            ShowPlayerDialog(playerid, DIALOG_FURNI2, DIALOG_STYLE_LIST, ""Green"Furniture & Supplies", string, "Purchase", "Next");
It shows the line up until half of the word Cooker and my string is set as 128 so should be okay..


Re: Line too long - Dignity - 03.05.2014

What are the numerals supposed to be? Object IDs?

Quote:

Kitchen Sink \nKitchen Sink 2 \nKitchen Sink 3 \nCooker \nCooker 2 \nWashing Machine \nWashing Machine 2 \n",

Is 109 letters, 92 without the \n seperators so object IDs (usually more than 4 digits) will cause your string length to exceed it's defined size.


Re: Line too long - Eth - 03.05.2014

pawn Код:
new string[500];
format(string, sizeof(string),
""White"Kitchen Sink ("Green"$%d"White")\nKitchen Sink 2 ("Green"$%d"White")\nKitchen Sink 3 ("Green"$%d"White")\nCooker ("Green"$%d"White")\nCooker 2 ("Green"$%d"White")\nWashing Machine ("Green"$%d"White")\nWashing Machine 2 ("Green"$%d"White")\n", KitSink, KitSink2, KitSink3, Cooker, Cooker2, Washer, Washer2);
            format(string, sizeof(string), "%sFridge ("Green"$%d"White")\nFryer ("Green"$%d"White")", string, Fridge, Fryer);
            ShowPlayerDialog(playerid, DIALOG_FURNI2, DIALOG_STYLE_LIST, ""Green"Furniture & Supplies", string, "Purchase", "Next");