Making text string longer -
milanosie - 14.01.2012
Код:
COMMAND:o(playerid, params[])
{
new text[258];
if(!sscanf(params, "s", text))
{
new name[MAX_PLAYER_NAME], string[350];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(text), "%s: [[%s]] ", name, text);
SendClientMessageToAll(COLOR_WHITE, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "USAGE: /o [Text]");
}
That is my code, but I can type like maximum of 60 characters when I use /o
Any idea?
Re: Making text string longer -
mineralo - 14.01.2012
I'm not sure but you should write new text[256]; but not 258
Re: Making text string longer -
Mean - 14.01.2012
Max chat string is about 150 (since 0.3c). There is no need of using 256.
pawn Код:
COMMAND:o(playerid, params[])
{
new text[150];
if(sscanf(params, "s[150]", text))
{
new name[MAX_PLAYER_NAME], string[150];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(text), "%s: [[%s]] ", name, text);
SendClientMessageToAll(COLOR_WHITE, string);
return 1;
}
else return SendClientMessage(playerid, COLOR_RED, "USAGE: /o [Text]");
}
Also, sscanf returns 0 on success, therefore you don't do "!sscanf."
Which version of sscanf are you using? You're probably not using the newest since you put strings without string size. Use the newest sscanf, find it with the "search" feature.
Re: Making text string longer -
milanosie - 14.01.2012
the code u posted should work?
Re: Making text string longer -
Mean - 14.01.2012
It should if you're using the newest sscanf plugin (or possibly sscanf stock?), try it, if it doesn't, you need another plugin.
Re: Making text string longer -
ivanVU - 14.01.2012
128 is maximum for SendClientMessage..
Re: Making text string longer -
Mean - 14.01.2012
Quote:
Originally Posted by ivanVU
128 is maximum for SendClientMessage..
|
No, it isn't. Since 0.3c, there was color embedding, and that embedding increased it to about 150. It is not 128
any more. It
was 128 in SA-MP 0.3b and earlier.