SA-MP Forums Archive
Strange Warning - 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: Strange Warning (/showthread.php?tid=392189)



Strange Warning - MarTaTa - 13.11.2012

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 !


Re: Strange Warning - Konstantinos - 13.11.2012

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



Re: Strange Warning - MarTaTa - 13.11.2012

Ohhh yeah, THANKS Anyways ! +REP for you