SA-MP Forums Archive
sscanf warning: Strings without a length are deprecated - 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: sscanf warning: Strings without a length are deprecated (/showthread.php?tid=454780)



sscanf warning: Strings without a length are deprecated - AntonioCroatia - 30.07.2013

I got warning:

Quote:

sscanf warning: Strings without a length are deprecated, please add a destination size.

on this...

Код:
COMMAND:email(playerid, params[])
{
	SendAdminText(playerid, "/email", params);
	new emaail[50], msg[64];
	// Check if the player has logged in
	if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PostavioEmail] == false)
	{
		if(sscanf(params, "s", emaail)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Komanda:{FF0000} {FFFFFF}/email <primjer@mail.com>{FFFFFF}");
		format(APlayerData[playerid][Email], 50, "%s", emaail);
		APlayerData[playerid][PostavioEmail] = true;
		format(msg, 64, "Unesao si svoju email adresu: %s", emaail);
		SendClientMessage(playerid, 0x00FF00FF, msg);
		PlayerFile_Save(playerid);
	}
	else return 0;
	return 1;
}



Re: sscanf warning: Strings without a length are deprecated - -=Dar[K]Lord=- - 30.07.2013

pawn Код:
COMMAND:email(playerid, params[])
{
    SendAdminText(playerid, "/email", params);
    new  msg[64];
    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PostavioEmail] == false)
    {
        if(sscanf(params, "c",params)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Komanda:{FF0000} {FFFFFF}/email <primjer@mail.com>{FFFFFF}");
        format(APlayerData[playerid][Email], 50, "%s",params);
        APlayerData[playerid][PostavioEmail] = true;
        format(msg, 64, "Unesao si svoju email adresu: %s",params);
        SendClientMessage(playerid, 0x00FF00FF, msg);
        PlayerFile_Save(playerid);
    }
    else return 0;
    return 1;
}
This Might Help , I am not sure


Re: sscanf warning: Strings without a length are deprecated - tyler12 - 30.07.2013

if(sscanf(params, "s", emaail))

The string has no size.

if(sscanf(params, "s[50]", emaail))


Re: sscanf warning: Strings without a length are deprecated - JimmyCh - 30.07.2013

pawn Код:
COMMAND:email(playerid, params[])
{
    SendAdminText(playerid, "/email", params);
    new emaail[50], msg[64];
    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PostavioEmail] == false)
    {
        if(sscanf(params, "s[50]", emaail)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Komanda:{FF0000} {FFFFFF}/email <primjer@mail.com>{FFFFFF}");
        format(APlayerData[playerid][Email], 50, "%s", emaail);
        APlayerData[playerid][PostavioEmail] = true;
        format(msg, 64, "Unesao si svoju email adresu: %s", emaail);
        SendClientMessage(playerid, 0x00FF00FF, msg);
        PlayerFile_Save(playerid);
    }
    else return 0;
    return 1;
}

EDIT: Damn too late


Re: sscanf warning: Strings without a length are deprecated - AntonioCroatia - 30.07.2013

Quote:
Originally Posted by -=Dar[K]Lord=-
Посмотреть сообщение
pawn Код:
COMMAND:email(playerid, params[])
{
    SendAdminText(playerid, "/email", params);
    new  msg[64];
    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PostavioEmail] == false)
    {
        if(sscanf(params, "c",params)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Komanda:{FF0000} {FFFFFF}/email <primjer@mail.com>{FFFFFF}");
        format(APlayerData[playerid][Email], 50, "%s",params);
        APlayerData[playerid][PostavioEmail] = true;
        format(msg, 64, "Unesao si svoju email adresu: %s",params);
        SendClientMessage(playerid, 0x00FF00FF, msg);
        PlayerFile_Save(playerid);
    }
    else return 0;
    return 1;
}
This Might Help , I am not sure
It's not work, it return me message Komanda:{FF0000} {FFFFFF}/email <primjer@mail.com>...


Quote:
Originally Posted by tyler12
Посмотреть сообщение
if(sscanf(params, "s", emaail))

The string has no size.

if(sscanf(params, "s[50]", emaail))
No warning, but it don't save...

Quote:
Originally Posted by JimmyCh
Посмотреть сообщение
pawn Код:
COMMAND:email(playerid, params[])
{
    SendAdminText(playerid, "/email", params);
    new emaail[50], msg[64];
    // Check if the player has logged in
    if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PostavioEmail] == false)
    {
        if(sscanf(params, "s[50]", emaail)) return SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Komanda:{FF0000} {FFFFFF}/email <primjer@mail.com>{FFFFFF}");
        format(APlayerData[playerid][Email], 50, "%s", emaail);
        APlayerData[playerid][PostavioEmail] = true;
        format(msg, 64, "Unesao si svoju email adresu: %s", emaail);
        SendClientMessage(playerid, 0x00FF00FF, msg);
        PlayerFile_Save(playerid);
    }
    else return 0;
    return 1;
}

EDIT: Damn too late
No warning, but it don't save...
Thanks all but warning isn't fixed...


Re: sscanf warning: Strings without a length are deprecated - thimo - 30.07.2013

What does it say? Still the same warning? If yes give us exactly the line that the warning is giving


Re: sscanf warning: Strings without a length are deprecated - Konstantinos - 30.07.2013

If it doesn't save, then the wrong part of it is
pawn Код:
PlayerFile_Save(playerid)
function.


Re: sscanf warning: Strings without a length are deprecated - AntonioCroatia - 30.07.2013

I found what it is, on PlayerFile_Save isn't to write email with size 50...
Thanks to Zeus and tyler12 Repped +