PDA

View Full Version : need help with strings


the.et
31/12/2011, 07:12 AM
Hi , i just started programming a SAMP server like two days ago.

I have a question , a noob question.

How can i output a string in SendClientMessage

CMD:shout( playerid, params[ ] )
{
new text[64];

if (sscanf(params, "s[64]", text))
return SendClientMessage( playerid, -1, "Usage: /shout <text>");

GameTextForAll(text, 2500, 5);
new string[ 256 ];
format(string, sizeof(string), ""COL_GREEN"Shout Out Sent:",text);
SendClientMessage(playerid, -1 ,string);

return 1;
}

If i type "/shout test" in CMD

The GameTextForAll() works but not the SendClientMessage as it output is "Shout Out Sent : " (it should be Shout Out Sent : test).
(color green is defined COL_GREEN)


What's my problem?

Thanks if you can help me.

Have a nice day.

Face9000
31/12/2011, 07:30 AM
new string[128]; //128 cells are enough.
format(string, sizeof(string), "COL_GREEN",Shout Out Sent: %s",text); //You forgot the %s string parser.
SendClientMessage(playerid, -1 ,string);

the.et
31/12/2011, 07:39 AM
Thank You Logitech90
+1 rep

Face9000
31/12/2011, 07:51 AM
No problem.