Chat issue - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Chat issue (
/showthread.php?tid=277371)
Chat issue -
Abreezy - 17.08.2011
Hey guys, I made an /ooc command for my server im making, and i used sscanf on it, but for some reason, it limits how many characters can be sent.. Like if i typed "Hey guys, welcome to my server, hope your having fun" it would only show like "Hey guys, welcome to my serv" and cut the rest out. I'm not sure the error, so let me show my command, and hopefully I could receive some help.
pawn Код:
CMD:o(playerid, params[]) {
new
str2ing[512];
if(sscanf(params, "s", sscanfinput)) return SendClientMessage(playerid, COLOR_RED, "Usage [::] /(o)oc yourmessage");
format(str2ing, sizeof(str2ing), "(( [OOC] %s: %s ))", pName(playerid), sscanfinput);
SendClientMessageToAll(COLOR_ORANGE, str2ing);
return 1;
Re: Chat issue -
Kingunit - 17.08.2011
Why your string is [512]?
Re: Chat issue -
KingTurtle - 17.08.2011
^ KingUnit was faster :<
First a question, why would you waste memory if you cannot type over 200 characters?
What is the size of "sscanfinput"? If your message is cut off, your array size is to low
Re: Chat issue -
Abreezy - 17.08.2011
My sscanfinput is the same size, 512. The reason i put to 512 was to keep testing new things, to see if i could figure out the problem.
Re: Chat issue -
Abreezy - 17.08.2011
bump, sorry for early bump, but i would like help with this issue.
Re: Chat issue -
Kush - 17.08.2011
Quote:
Originally Posted by Abreezy
Hey guys, I made an /ooc command for my server im making, and i used sscanf on it, but for some reason, it limits how many characters can be sent.. Like if i typed "Hey guys, welcome to my server, hope your having fun" it would only show like "Hey guys, welcome to my serv" and cut the rest out. I'm not sure the error, so let me show my command, and hopefully I could receive some help.
pawn Код:
CMD:o(playerid, params[]) { new str2ing[512]; if(sscanf(params, "s", sscanfinput)) return SendClientMessage(playerid, COLOR_RED, "Usage [::] /(o)oc yourmessage"); format(str2ing, sizeof(str2ing), "(( [OOC] %s: %s ))", pName(playerid), sscanfinput); SendClientMessageToAll(COLOR_ORANGE, str2ing); return 1;
|
PHP код:
CMD:o(playerid, params[])
{
new string[128];
if(sscanf(params, "s[128]", params)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ooc [message]");
format(string, sizeof(string), "(( [OOC] %s: %s))", pName(playerid), params);
SendClientMessageToAll(COLOR_ORANGE, string);
return 1;
}
Re: Chat issue -
Abreezy - 17.08.2011
Good lucks for all the help -
Re: Chat issue -
Kush - 17.08.2011
Quote:
Originally Posted by Abreezy
This works, but after i start putted alot of text, the last )) stop showing up.
|
How much text exactly? Could be montior related, could be character input max size.
Re: Chat issue -
Abreezy - 17.08.2011
Quote:
Originally Posted by Kush
How much text exactly? Could be montior related, could be character input max size.
|
I noticed it only happens with numbers, with letters/words, it is perfect. Thanks for the help..-
Re: Chat issue -
=WoR=Varth - 18.08.2011
pawn Код:
CMD:o(playerid, params[])
{
if(isnull(params)) return SendClientMessage(playerid, COLOR_RED, "Usage [::] /(o)oc yourmessage");
format(params,170,"(( [OOC] %s: %s ))",pName(playerid),params);
SendClientMessageToAll(COLOR_ORANGE,params);
return 1;
}