Make long strings?
#1

Anyone knows how to create long strings in format? because I used a string with 200char but I still need more characters , I heard about strcat but don't know what to do...
Reply
#2

I posted an example yesterday, it should give you an idea about how to use it:
Quote:
Originally Posted by zombieking
Посмотреть сообщение
pawn Код:
new long_string[632];
strcat(long_string,"{FFFFFF}Welcome To Our Server ! / {FFFFFF}Sveiki Atvyke i Musu Serveri !\n \nThe predominant language in this server is : Lithuanian.\n");
strcat(long_string,"{FFFFFF}Because the half of players are from other countries we set language to English.\nU can change language by typing :\n\n{FFFF00}/LTU {FFFFFF}");
strcat(long_string,"- For Lithuanian \n\n{FFFF00}/ENG {FFFFFF}- For English\n\n{FFFFFF}Pagrindine sio serverio kalba yra : Anglu.\n{FFFFFF}Daugybe sio serverio zaideju yra is kitu pasaulio saliu , mes nustateme kalba i Anglu.\n");
strcat(long_string,"Kalba galite pakeisti rasydami:\n\n{FFFF00}/LTU {FFFFFF}- Lietuviu Kalba\n\n{FFFF00}/ENG {FFFFFF}- Anglu Kalba");
ShowPlayerDialog(playerid, 1112, DIALOG_STYLE_MSGBOX, "Welcome / Sveiki Atvyke !", long_string, "Ok", "");
This should work.
Reply
#3

I did it likes new string[1024]; <<<<<<<<<< it very fine worked for me
Reply
#4

Quote:
Originally Posted by por12802
Посмотреть сообщение
I did it likes new string[1024]; <<<<<<<<<< it very fine worked for me
Why would you need that big?
Reply
#5

Yea it is useful when we only have texts , but in my case I have values like Level:%d...

EDIT:
Код:
I did it likes new string[1024]; <<<<<<<<<< it very fine worked for me
Gonna try it( & I only need 300char )

2nd edit:

thanks ! it works only had to change the string
Reply
#6

If you are strcat'ing two strings, say string1[300] is the one where you are concatenating string2[300], make sure that the addition is bigger than the cells - string1[601] !
Reply
#7

Fixed the problem thank you all

@Rajat : yea I have two strings with name str1 & str2 but the str1 need more place that's all
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)