Huge string - 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: Huge string (
/showthread.php?tid=322209)
Huge string -
Larry123 - 01.03.2012
Hello
I try to do DIALOG_STYLE_INPUT with a lot of car names. So when i use like this:
(Top of script)
Код:
#define CARS "Names\nNames...."
And in command:
Код:
ShowPlayerDialog( playerid, 1, DIALOG_STYLE_LIST, "Cars", CARS, "Button1", "Button2" );
Then in compile my pawno crash.
When i put it in string:
Код:
New string[1024];
format( string, sizeof( string ), "Names\nNames...." );
ShowPlayerDialog( playerid, 1, DIALOG_STYLE_LIST, "Cars", string, "Button1", "Button2" );
Then in compile it says:
Код:
C:\samp03dsvr_R2_win32\gamemodes\GamemodeRoleplay.pwn(3336) : error 075: input line too long (after substitutions)
C:\samp03dsvr_R2_win32\gamemodes\GamemodeRoleplay.pwn(3337) : error 037: invalid string (possibly non-terminated string)
So... what is solution to make huge string and use it in dialogs, how can i do, that i still can use all these car names in dialog ?
Re: Huge string - T0pAz - 01.03.2012
Why do you need so huge string size?
Re: Huge string -
Stylock - 01.03.2012
Use strcat
https://sampwiki.blast.hk/wiki/Strcat.
Re: Huge string -
Universal - 01.03.2012
Use strcat. An example:
pawn Код:
new string[129];
string[0] = '\0';
strcat(string, "This is a line\n", sizeof(string));
strcat(string, "This is another line\n", sizeof(string));
strcat(string, "Die potato\n", sizeof(string));
Re: Huge string -
Larry123 - 01.03.2012
Hmm that is going very big, i have to put in almost all cars, for car shop. There isnt any better way ?
Re: Huge string -
milanosie - 01.03.2012
Make them in catogories like OffRoad, Sport, Saloon, Saloon2, Etc.
Re: Huge string - T0pAz - 01.03.2012
Quote:
Originally Posted by Larry123
Hmm that is going very big, i have to put in almost all cars, for car shop. There isnt any better way ?
|
Use string concatenation as show above. If I were on your place, I would do that on an array.
Re: Huge string -
Larry123 - 01.03.2012
hmm with strcat? Or what did you mean? Any little exampe can you show ?
Re: Huge string - T0pAz - 01.03.2012
Quote:
Originally Posted by Larry123
hmm with strcat? Or what did you mean? Any little exampe can you show ?
|
Post Num: 4.
Re: Huge string -
Larry123 - 01.03.2012
Okei, i start putting my almost all cars in there ..