need help with 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: need help with strings (
/showthread.php?tid=307599)
need help with strings -
the.et - 31.12.2011
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.
Re: need help with strings -
Face9000 - 31.12.2011
pawn Код:
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);
Re: need help with strings -
the.et - 31.12.2011
Thank You Logitech90
+1 rep
Re: need help with strings -
Face9000 - 31.12.2011
No problem.