PDA

View Full Version : Too long line..


,TomY'
07/07/2016, 11:04 PM
Hi. My line is too long:
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.

Alpay0098
07/07/2016, 11:23 PM
Hi. My line is too long:
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:

new string1[128],string2[128],string3[128],stringt[1024];
format(string1, sizeof(string1), "blah blah blah");
format(string2, sizeof(string2), "blah2 blah2 blah2");
format(string3, sizeof(string3), "blah3 blah3 blah3");
format(stringt, sizeof(stringt), "%s\n%s\n%s", string1, string2, string3);
ShowPlayerDialog(playerid, DIALOG_X,DIALOG_STYLE_LIST, "Title", stringt, "Done Button", "Cancel Button");

IceBilizard
08/07/2016, 03:04 AM
It must be something like this:

new string1[128],string2[128],string3[128],stringt[1024];
format(string1, sizeof(string1), "blah blah blah");
format(string2, sizeof(string2), "blah2 blah2 blah2");
format(string3, sizeof(string3), "blah3 blah3 blah3");
format(stringt, sizeof(stringt), "%s\n%s\n%s", string1, string2, string3);
ShowPlayerDialog(playerid, DIALOG_X,DIALOG_STYLE_LIST, "Title", stringt, "Done Button", "Cancel Button");

Why should he using alot of strings?

take this as example


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

Napst34
08/07/2016, 03:08 AM
Or just use this:
ShowPlayerDialog(playerid, dialogid, DIALOG_STYLE_LIST, "Buy Weapon",
"Item 0\n\
Item 1\n\
Item 2\n\
"Select", "Cancel");

Mencent
08/07/2016, 08:29 AM
@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. ;)

Luicy.
08/07/2016, 09:00 AM
Use strcat.

gurmani11
08/07/2016, 09:57 AM
Use strcat.
of course this feature should be used. not format