Chat issue
#1

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

Why your string is [512]?
Reply
#3

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

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

bump, sorry for early bump, but i would like help with this issue.
Reply
#6

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(playeridparams[])
{
    new 
string[128];
    if(
sscanf(params"s[128]"params)) return SendClientMessage(playeridCOLOR_RED"USAGE: /ooc [message]");
    
format(stringsizeof(string), "(( [OOC] %s: %s))"pName(playerid), params);
    
SendClientMessageToAll(COLOR_ORANGEstring);
    return 
1;

Reply
#7

Good lucks for all the help -
Reply
#8

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

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

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)