SA-MP Forums Archive
sscanf console 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: sscanf console error (/showthread.php?tid=145555)



sscanf console error - Deji - 02.05.2010

The following error occurs in the server console window. It compiles fine, with no warnings (except the obvious "unused symbols" that are there for future purposes).
Quote:

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

I see no space for a size parameter, so I'm confused:

Код:
command(login, playerid, params[])
{
	if(gPlayerLogged[playerid] == 0)
	{
		new name[MAX_PLAYER_NAME];
		new file[MAX_PLAYER_NAME+5];	// player name + file extension + 2 for luck.
		new password[120];
		new tmp[120];

		format(file, sizeof(file), "%s.ini", name);
		if(sscanf(params, "s", password))
		{
		  SendClientMessage(playerid, COLOR_USAGE, "Usage: \"/login [password]\"");
		}



Re: sscanf console error - Fj0rtizFredde - 02.05.2010

pawn Код:
if(sscanf(params, "s[128]", password)) //The string need so have a size
{
SendClientMessage(playerid, COLOR_USAGE, "Usage: \"/login [password]\"");
}



Re: sscanf console error - Deji - 02.05.2010

Ahh thanks. Makes sense, I guess. But I figured it would take the size of the destination var