SA-MP Forums Archive
Simple and quick question - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Simple and quick question (/showthread.php?tid=223243)



Simple and quick question - p00jan - 09.02.2011

Hello, how to join 2 variable with array into a string?

Код:
	new s[256];
	new Name[256];
	new FullLine[256];
	if(row < TEAM_MENU_ITEMS) {
		format(s,256,"You selected team %s",TeamStrings[row]);
		SendClientMessage(playerid,0xFFFFFFFF,s);
		GetPlayerName(playerid,Name,256);
		format(FullLine,256,B "%s has joined team " TeamStrings[row],Name);
		SendClientMessageToAll(COLOR_RED,FullLine);
That doesn't work.


Re: Simple and quick question - Kwarde - 09.02.2011

Sorry what do you mean? "Join" 2 variables in a string. I don't get the word "Join" :P - Converting two variables in one string's easy...


Re: Simple and quick question - fangoth1 - 09.02.2011

you missed your comma by teamstrings
pawn Код:
format(FullLine,256,B "%s has joined team ", TeamStrings[row],Name);



Re: Simple and quick question - p00jan - 09.02.2011

Yes I want to know how to join 2 variables into 1 string. Both strings with array and the strings without array.


Re: Simple and quick question - Kwarde - 09.02.2011

pawn Код:
new string1[50], string2[50], string3[50];
format(string1, 50, "String 1!");
format(string2, 50, "String 2!");
format(string3, 50, "%s + %s = String 3!", string1, string2);
printf("%s", string3);
This will put "String1! + String2! = String 3!" in your console. Is this what you want?