SA-MP Forums Archive
Making a long string but it does not work :/ - 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: Making a long string but it does not work :/ (/showthread.php?tid=285479)



Making a long string but it does not work :/ - knackworst - 24.09.2011

hi, I want to create a very long msgbox so
I saw in some script a way to do this, and I found it a very good idea...
so I have this:
pawn Код:
new OptionsList[1024], OptionsList2[1024], OptionsList3[1024];
                format(OptionsList, sizeof(OptionsList), "%sWelcome in team Bandits! Level 1! \n\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sThere are several ways to raise your level, get money and just have fun!\n\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sJobs:\n\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sAs a driver your task is to bring people from one place to another.\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sTo do so, enter the car wich is equal to your level, wich is a nebula for level 1.\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sWhen entering the car you will get some ClientMessages giving you some information about starting a job\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sAs explained there, starting a job can be easly done by driving to the little checkpoint, in front of this tennis club\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sFrom there a mission will start randomly according to your level.\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sThen a TextDraw will appear on the bottom of your screen, telling you where to go.\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sThe place marked with: ''place'' is the place where to pick up your famous person, and a mapicon will appear\n", OptionsList);
                format(OptionsList, sizeof(OptionsList), "%sJust follow the map icon, and you will get to your destination.\n", OptionsList);
                format(OptionsList, sizeof(OptionsList2), "%sWhen you are there you have picked up your famous person, and a new mapicon will be set. also the '' marks will change.\n", OptionsList);
                format(OptionsList, sizeof(OptionsList2), "%sAgain, follow the mapicon and you will get on your final destination, where you will be given a reward\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList2), "%sIt's important that:\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList2), "%sYou stay in your car\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList2), "%sYou get as least Vehicle damage as possible (you will get a reward then)\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList2), "%sAnd drive not faster than the max allowed speed, if you do so you will become a suspect!\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList2), "%sCompleting a job will give you an amount of score and money, according to your level\n\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList2), "%sMinigames:\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList2), "%sIf you want to get more score and money at once, you will have to do minigames\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList3), "%sUnfortunately you will need atleast 500 score to participe to a minigame\n", OptionsList2);
                format(OptionsList, sizeof(OptionsList3), "%sStill if you want to know more about them already, type /minigames\n\n\n", OptionsList3);
                format(OptionsList, sizeof(OptionsList3), "%sOther from that, I just want to wish you joy and fun on this server as a driver!\n", OptionsList3);
                // Show the Msgbow
                ShowPlayerDialog(playerid, 1777, DIALOG_STYLE_MSGBOX, "Test", OptionsList, "Select", "Cancel");
but I only get the very last message, in the msgbox :/
plz help


Re: Making a long string but it does not work :/ - aRoach - 24.09.2011

Use strcat, like this:
pawn Код:
strcat( OptionList, "Welcome in team Bandits! Level 1! \n\n" );
strcat( OptionList, "There are several ways to raise your level, get money and just have fun!\n\n" );
strcat( OptionList, "Jobs:\n\n" );
strcat( OptionList, "As a driver your task is to bring people from one place to another.\n" );
// And the all strings in one



Re: Making a long string but it does not work :/ - Improvement™ - 24.09.2011

What you are searching for is called strcat.

Take a look into this pastebin for examples:
http://pastebin.com/e4mqNfgQ


Re: Making a long string but it does not work :/ - aRoach - 24.09.2011

Quote:
Originally Posted by Improvement™
Посмотреть сообщение
What you are searching for is called strcat.

Take a look into this pastebin for examples:
http://pastebin.com/e4mqNfgQ
You posted the same thing...


Re: Making a long string but it does not work :/ - Improvement™ - 24.09.2011

Quote:
Originally Posted by aRoach
Посмотреть сообщение
You posted the same thing...
And if you would've taken the effort on looking at the post date and time, then you would've noticed that the time is exactly the same as yours. But you were simply faster, so there's no need for you to make some useless reply and discuss about that.


Re: Making a long string but it does not work :/ - knackworst - 24.09.2011

Thank you, both of you, but Do I have to create 2 strings? because the string I wanna input is more than 1054 chars, wich is the maximum :/


Re: Making a long string but it does not work :/ - aRoach - 24.09.2011

Well you don't need create 2 Strings just do:
pawn Код:
new OptionList[ 5000 ];
For Example


Re: Making a long string but it does not work :/ - knackworst - 24.09.2011

thanks, but now I get this in the compiler:
Код:
Header size:           9764 bytes
Code size:           452700 bytes
Data size:          1075424 bytes
Stack/heap size:      16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements: 1554272 bytes
that's normal, or?

the strcat things:
pawn Код:
//Msgbox
                new OptionList[ 5000 ];
                strcat( OptionList, "Welcome in team Bandits! Level 1! \n\n" );
                strcat( OptionList, "There are several ways to raise your level, get money and just have fun!\n\n" );
                strcat( OptionList, "Jobs:\n\n" );
                strcat( OptionList, "As a driver your task is to bring people from one place to another.\n" );
               
                strcat( OptionList, "%sWelcome in team Bandits! Level 1! \n\n");
                strcat( OptionList, "%sThere are several ways to raise your level, get money and just have fun!\n\n");
                strcat( OptionList, "%sJobs:\n\n");
                strcat( OptionList, "%sAs a driver your task is to bring people from one place to another.\n");
                strcat( OptionList, "%sTo do so, enter the car wich is equal to your level, wich is a nebula for level 1.\n");
                strcat( OptionList, "%sWhen entering the car you will get some ClientMessages giving you some information about starting a job\n");
                strcat( OptionList, "%sAs explained there, starting a job can be easly done by driving to the little checkpoint, in front of this tennis club\n");
                strcat( OptionList, "%sFrom there a mission will start randomly according to your level.\n");
                strcat( OptionList, "%sThen a TextDraw will appear on the bottom of your screen, telling you where to go.\n");
                strcat( OptionList, "%sThe place marked with: ''place'' is the place where to pick up your famous person, and a mapicon will appear\n");
                strcat( OptionList, "%sJust follow the map icon, and you will get to your destination.\n");

                strcat( OptionList, "%sWhen you are there you have picked up your famous person, and a new mapicon will be set. also the '' marks will change.\n");
                strcat( OptionList, "%sAgain, follow the mapicon and you will get on your final destination, where you will be given a reward\n");
                strcat( OptionList, "%sIt's important that:\n");
                strcat( OptionList, "%sYou stay in your car\n");
                strcat( OptionList, "%sYou get as least Vehicle damage as possible (you will get a reward then)\n");
                strcat( OptionList, "%sAnd drive not faster than the max allowed speed, if you do so you will become a suspect!\n");
                strcat( OptionList, "%sCompleting a job will give you an amount of score and money, according to your level\n\n");
                strcat( OptionList, "%sMinigames:\n");
                strcat( OptionList, "%sIf you want to get more score and money at once, you will have to do minigames\n");
                strcat( OptionList, "%sUnfortunately you will need atleast 500 score to participe to a minigame\n");
                strcat( OptionList, "%sStill if you want to know more about them already, type /minigames\n\n\n");
                strcat( OptionList, "%sOther from that, I just want to wish you joy and fun on this server as a driver!\n");
               
                // Show the Msgbow
                ShowPlayerDialog(playerid, 1777, DIALOG_STYLE_MSGBOX, "Test", OptionList, "Ok", "");



Re: Making a long string but it does not work :/ - aRoach - 24.09.2011

Without %s, delete all the %s in the STRCAT...


Re: Making a long string but it does not work :/ - CyNiC - 24.09.2011

For clean the compile window, put on the top:
pawn Код:
#pragma dynamic 10000
The standart is 8000, try your own values, it'll give more stack for the amx file.