SA-MP Forums Archive
Make long strings? - 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: Make long strings? (/showthread.php?tid=427063)



Make long strings? - Mrich - 31.03.2013

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...


Re: Make long strings? - zombieking - 31.03.2013

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.



Re: Make long strings? - por12802 - 31.03.2013

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


Re: Make long strings? - LeeXian99 - 31.03.2013

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


Re: Make long strings? - Mrich - 31.03.2013

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


Re: Make long strings? - RajatPawar - 31.03.2013

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] !


Re: Make long strings? - Mrich - 31.03.2013

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