SA-MP Forums Archive
strings are deprecated error. - 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: strings are deprecated error. (/showthread.php?tid=560044)



strings are deprecated error. - OMonger - 26.01.2015

pawn Код:
command(helpme, playerid, params[])
{
    new help[255], string[128];
    if(sscanf(params, "s", help))
    {
        SendClientMessage(playerid,-1, "SYNTAX: /helpme [message]");
    }
    else
    {
        format(string, sizeof(string), "{FE2EC8}[HELP]: {FFFFFF}%s{FE2EC8}: %d", playerid, help);
        SendToStaff(COLOR_PINK, string);
        SendClientMessage(playerid, YELLOW, "Your question was sent to the Staff team, await a reply.");
    }
    return 1;
}
When I type this command in game, it comes up with an error in the server log. "sscanf warning: Strings without a length are deprecated, please add a destination size." Please can you help me?


Re: strings are deprecated error. - Jefff - 26.01.2015

pawn Код:
command(helpme, playerid, params[])
{
    if(isnull(params)) SendClientMessage(playerid,-1, "SYNTAX: /helpme [message]");
    else{
        new string[145];
        format(string, sizeof(string), "{FE2EC8}[HELP]: {FFFFFF}%s{FE2EC8}: %d", params, playerid);
        SendToStaff(COLOR_PINK, string);
        SendClientMessage(playerid, YELLOW, "Your question was sent to the Staff team, await a reply.");
    }
    return 1;
}



Re: strings are deprecated error. - Excel™ - 26.01.2015

pawn Код:
command(helpme, playerid, params[])
{
    new help[128], string[255];
    if(sscanf(params, "s[128]", help))
    {
        SendClientMessage(playerid,-1, "SYNTAX: /helpme [message]");
    }
    else
    {
        format(string, sizeof(string), "{FE2EC8}[HELP]: {FFFFFF}%s{FE2EC8}: %d", playerid, help);
        SendToStaff(COLOR_PINK, string);
        SendClientMessage(playerid, YELLOW, "Your question was sent to the Staff team, await a reply.");
    }
    return 1;
}