SA-MP Forums Archive
Too long line.. - 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: Too long line.. (/showthread.php?tid=611547)



Too long line.. - ,TomY' - 07.07.2016

Hi. My line is too long:
Code:
Dialog_ShowCallback(pid, using inline dialog5, DIALOG_STYLE_LIST, "Valdymas",f("Leidimas vairuoti infernus(%s)\nLeidimas vairuoti elegy(%s)\nLeidimas pilotuoti Hunter(%s)\nLeidimas pilotuoti Hydra(%s)\nLeidimas vairuoti nrg-500(sunkveћimis)(%s)\nLeidimas vairuoti turismo(%s)\nLeidimas vairuoti super-gt(valtis)(%s)\nLeidimas pilotuoti sanchez(%s)\nLeidimas vairuoti bmx(%s)\nLeidimas vairuoti test(%s)", (Rangs[prang][tr1]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr2]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr3]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr4]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr5]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr6]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr7]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr8]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr9]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr10]) ? ("Yra") : ("Nėra")), "Toliau", "Iљeiti");
I know, that I need use strcmp, but dont know how. Maybe somebody can show me, how this line must be? Thanks a lot.


Re: Too long line.. - Alpay0098 - 07.07.2016

Quote:
Originally Posted by ,TomY'
View Post
Hi. My line is too long:
Code:
Dialog_ShowCallback(pid, using inline dialog5, DIALOG_STYLE_LIST, "Valdymas",f("Leidimas vairuoti infernus(%s)\nLeidimas vairuoti elegy(%s)\nLeidimas pilotuoti Hunter(%s)\nLeidimas pilotuoti Hydra(%s)\nLeidimas vairuoti nrg-500(sunkveћimis)(%s)\nLeidimas vairuoti turismo(%s)\nLeidimas vairuoti super-gt(valtis)(%s)\nLeidimas pilotuoti sanchez(%s)\nLeidimas vairuoti bmx(%s)\nLeidimas vairuoti test(%s)", (Rangs[prang][tr1]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr2]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr3]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr4]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr5]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr6]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr7]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr8]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr9]) ? ("Yra") : ("Nėra"),(Rangs[prang][tr10]) ? ("Yra") : ("Nėra")), "Toliau", "Iљeiti");
I know, that I need use strcmp, but dont know how. Maybe somebody can show me, how this line must be? Thanks a lot.
It must be something like this:
PHP Code:
new string1[128],string2[128],string3[128],stringt[1024];
format(string1sizeof(string1), "blah blah blah");
format(string2sizeof(string2), "blah2 blah2 blah2");
format(string3sizeof(string3), "blah3 blah3 blah3");
format(stringtsizeof(stringt), "%s\n%s\n%s"string1string2string3);
ShowPlayerDialog(playeridDIALOG_X,DIALOG_STYLE_LIST"Title"stringt"Done Button""Cancel Button"); 



Re: Too long line.. - IceBilizard - 08.07.2016

Quote:
Originally Posted by Alpay0098
View Post
It must be something like this:
PHP Code:
new string1[128],string2[128],string3[128],stringt[1024];
format(string1sizeof(string1), "blah blah blah");
format(string2sizeof(string2), "blah2 blah2 blah2");
format(string3sizeof(string3), "blah3 blah3 blah3");
format(stringtsizeof(stringt), "%s\n%s\n%s"string1string2string3);
ShowPlayerDialog(playeridDIALOG_X,DIALOG_STYLE_LIST"Title"stringt"Done Button""Cancel Button"); 
Why should he using alot of strings?

take this as example

PHP Code:
new string[1024];
format(stringsizeof(string), "%sLeidimas vairuoti infernus(%s)\n",string, (Rangs[prang][tr1]) ? ("Yra") : ("Nera"));
format(stringsizeof(string), "%sLeidimas vairuoti elegy(%s)\n",string, (Rangs[prang][tr2]) ? ("Yra") : ("Nera"));
//Here can add more string messages
ShowPlayerDialog(playeridDDIALOG_XDIALOG_STYLE_LIST"Title"string"BUTTON1""BUTTON2"); 



Re: Too long line.. - Napst34 - 08.07.2016

Or just use this:
Code:
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Buy Weapon",
"Item 0\n\
Item 1\n\
Item 2\n\
"Select", "Cancel");



Re: Too long line.. - Mencent - 08.07.2016

@Napst34:
No, it won't work, because the compile put this into one line when it will compile the script.
You have to work with format or strcat.


Re: Too long line.. - Luicy. - 08.07.2016

Use strcat.


Re: Too long line.. - gurmani11 - 08.07.2016

Quote:
Originally Posted by Meller
View Post
Use strcat.
of course this feature should be used. not format