Strange Warning
#1

Hello everyone,
So I was making my own Custom Faction System, and after I compile, everything looks okay, no Errors / Warnings.
I've tested everything, and it was working too, but I've took a look on the Server Log and it was showing this alot of times :
Код:
sscanf warning: Strings without a length are deprecated, please add a destination size.
So I've tested it once again and I've notieced it is happening because of my /®adio command
Here's the code for it :
pawn Код:
CMD:r(playerid, params[])
{
    if(PlayerInfo[playerid][pFaction] >= 1)
    {
        new string[128];
        if(sscanf(params, "s", string)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/r [text]");
        for(new f; f < MAX_PLAYERS; f++)
        {
            if(PlayerInfo[f][pFaction] == 1)
            {
                if(PlayerInfo[f][pFacRank] == 1)
                {
                    format(string, sizeof(string), "** Cadet %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_LSPD, string);
                }
                if(PlayerInfo[f][pFacRank] == 2)
                {
                    format(string, sizeof(string), "** Officer %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_LSPD, string);
                }
                if(PlayerInfo[f][pFacRank] == 3)
                {
                    format(string, sizeof(string), "** Sergeant %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_LSPD, string);
                }
                if(PlayerInfo[f][pFacRank] == 4)
                {
                    format(string, sizeof(string), "** Lieutenant %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_LSPD, string);
                }
                if(PlayerInfo[f][pFacRank] == 5)
                {
                    format(string, sizeof(string), "** Captain %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_LSPD, string);
                }
                if(PlayerInfo[f][pFacRank] == 6)
                {
                    format(string, sizeof(string), "** Chief %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_LSPD, string);
                }
            }
            if(PlayerInfo[f][pFaction] == 2)
            {
                if(PlayerInfo[f][pFacRank] == 1)
                {
                    format(string, sizeof(string), "** Probationary Agent %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FBI, string);
                }
                if(PlayerInfo[f][pFacRank] == 2)
                {
                    format(string, sizeof(string), "** Agent %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FBI, string);
                }
                if(PlayerInfo[f][pFacRank] == 3)
                {
                    format(string, sizeof(string), "** Special Agent %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FBI, string);
                }
                if(PlayerInfo[f][pFacRank] == 4)
                {
                    format(string, sizeof(string), "** Section Chief %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FBI, string);
                }
                if(PlayerInfo[f][pFacRank] == 5)
                {
                    format(string, sizeof(string), "** Deputy Director %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FBI, string);
                }
                if(PlayerInfo[f][pFacRank] == 6)
                {
                    format(string, sizeof(string), "** Director %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FBI, string);
                }
            }
            if(PlayerInfo[f][pFaction] == 3)
            {
                if(PlayerInfo[f][pFacRank] == 1)
                {
                    format(string, sizeof(string), "** Paramedic %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FDSA, string);
                }
                if(PlayerInfo[f][pFacRank] == 2)
                {
                    format(string, sizeof(string), "** Special Paramedic %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FDSA, string);
                }
                if(PlayerInfo[f][pFacRank] == 3)
                {
                    format(string, sizeof(string), "** Lieutenant %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FDSA, string);
                }
                if(PlayerInfo[f][pFacRank] == 4)
                {
                    format(string, sizeof(string), "** Captain %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FDSA, string);
                }
                if(PlayerInfo[f][pFacRank] == 5)
                {
                    format(string, sizeof(string), "** Deputy Chief %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FDSA, string);
                }
                if(PlayerInfo[f][pFacRank] == 6)
                {
                    format(string, sizeof(string), "** Chief %s: %s **", RPName(playerid), string);
                    SendClientMessage(f, COLOR_FDSA, string);
                }
            }
        }
    }
    return 1;
}
Someone knows whats causes this Warning ?

Thanks in advance !
Reply
#2

Replace with
pawn Код:
if(sscanf(params, "s[128]", string)) return SendClientMessage(playerid, COLOR_GRAD2, "USAGE: {FFFFFF}/r [text]");
Reply
#3

Ohhh yeah, THANKS Anyways ! +REP for you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)