sscanf warning: Strings without a length are deprecated
#1

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;
}
Reply
#2

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
Reply
#3

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

The string has no size.

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

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
Reply
#5

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...
Reply
#6

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

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)