SA-MP Forums Archive
Combining strings in one paramater? - 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: Combining strings in one paramater? (/showthread.php?tid=419217)



Combining strings in one paramater? - Nathan_Taylor - 27.02.2013

So, If I have two strings defined, like "name" and "message", and I want to send them both in the same "SendClientMessageToAll();" how can I do it?

Код:
SendClientMessageToAll(COLOR_LIGHTBLUE, "(ADMIN) "+ user + " says " message);
Something like that


Re: Combining strings in one paramater? - 2KY - 27.02.2013

Use format!

pawn Код:
new string [ 128 ];

format( string, sizeof ( string ), "(ADMIN) %s says %s", user, message );
SendClientMessageToAll ( -1, string );
%s is a string, this is a combination of characters and numbers.

The first %s turns into whatever "user" is defined to, and the second %s turns into the message inputted.


Re: Combining strings in one paramater? - Nathan_Taylor - 27.02.2013

Quote:
Originally Posted by 2KY
Посмотреть сообщение
Use format!

pawn Код:
new string [ 128 ];

format( string, sizeof ( string ), "(ADMIN) %s says %s", user, message );
SendClientMessageToAll ( -1, string );
%s is a string, this is a combination of characters and numbers.

The first %s turns into whatever "user" is defined to, and the second %s turns into the message inputted.
Okay, just out of curiosity, what is the "-1" in the SendClientMessagetoAll you wrote?


Respuesta: Combining strings in one paramater? - Strier - 27.02.2013

-1 Means color white...

You can use color embedding in format to change the colours of the text

https://sampwiki.blast.hk/wiki/SendClientMessage


Re: Combining strings in one paramater? - Nathan_Taylor - 27.02.2013

Thanks, +REP