String errors.
#1

Hey!

It's me again, I just saw in my server's console when I use my /me or /pm command, an error message appears in it:

"sscanf warning: strings without a lenght are deprecated, please add a destination size"

It's new for me, please help how can i solve this problem. Thanks.

pawn Код:
dcmd_me(playerid, params[])
{
    new
        msg[100],
        str[128];
    if(sscanf(params, "s", msg)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>");
    if(strlen(msg) < 1) return SendClientMessage(playerid, colorFAIL, "Min. 1 karakter!");
    if(strlen(msg) > 100) return SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!");
    format(str, sizeof(str), "%s %s.", GetName(playerid), msg);
    SendClientMessageToAll(color, str);
    return 1;
}
Reply
#2

pawn Код:
dcmd_me(playerid, params[])
{
    new
        msg[100],
        str[128];
    if(sscanf(params, "s[100]", msg)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>");
    if(strlen(msg) < 1) return SendClientMessage(playerid, colorFAIL, "Min. 1 karakter!");
    if(strlen(msg) > 100) return SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!");
    format(str, sizeof(str), "%s %s.", GetName(playerid), msg);
    SendClientMessageToAll(color, str);
    return 1;
}
Try that notice the sscanf line

Edit: Noticed msg was 100cells so change sscanf line.
Reply
#3

Quote:
Originally Posted by iggy1
Посмотреть сообщение
pawn Код:
dcmd_me(playerid, params[])
{
    new
        msg[100],
        str[128];
    if(sscanf(params, "s[128]", msg)) return SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>");
    if(strlen(msg) < 1) return SendClientMessage(playerid, colorFAIL, "Min. 1 karakter!");
    if(strlen(msg) > 100) return SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!");
    format(str, sizeof(str), "%s %s.", GetName(playerid), msg);
    SendClientMessageToAll(color, str);
    return 1;
}
Try that notice the sscanf line
Aha, thanks a lot.
Reply
#4

No problem m8 i had that problem too when i started using the plugin
Reply
#5

https://sampforum.blast.hk/showthread.php?tid=55261
Search: You don't need it (2)
Try:
pawn Код:
dcmd_me(playerid, params[])
{
    new
        msg[128];
    if(sscanf(params, "s[128]", msg)) SendClientMessage(playerid, colorFAIL, "Hasznбlat: /me <szцveg>");
    else if(strlen(msg) > 100) SendClientMessage(playerid, colorFAIL, "Max. 100 karakter!");
    else {
        format(msg, sizeof(msg), "%s %s.", GetName(playerid), msg);
        SendClientMessageToAll(color, msg);
    }
    return true;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)