Combining strings in one paramater?
#1

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

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

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

-1 Means color white...

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

https://sampwiki.blast.hk/wiki/SendClientMessage
Reply
#5

Thanks, +REP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)