Huge string
#1

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 ?
Reply
#2

Why do you need so huge string size?
Reply
#3

Use strcat https://sampwiki.blast.hk/wiki/Strcat.
Reply
#4

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));
Reply
#5

Hmm that is going very big, i have to put in almost all cars, for car shop. There isnt any better way ?
Reply
#6

Make them in catogories like OffRoad, Sport, Saloon, Saloon2, Etc.
Reply
#7

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.
Reply
#8

hmm with strcat? Or what did you mean? Any little exampe can you show ?
Reply
#9

Quote:
Originally Posted by Larry123
Посмотреть сообщение
hmm with strcat? Or what did you mean? Any little exampe can you show ?
Post Num: 4.
Reply
#10

Okei, i start putting my almost all cars in there ..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)