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

Код:
COMMAND:top10(playerid, params[])
{
	mysql_query("SELECT `playerName`, `playerXP` FROM `playerdata` WHERE `playerXP` > 0 ORDER BY `playerXP` DESC LIMIT 10");
	mysql_store_result();
	if(mysql_num_rows() > 0) {
	    new
	        playerName[MAX_PLAYER_NAME],
	        playerXP,
	        i = 1,
	        szMessage[640],
	        szReturn[640];

	    while(mysql_fetch_row(szReturn)) {
	        sscanf(szReturn, "p<|>s[120]d", playerName, playerXP);

			format(szMessage, sizeof(szMessage), "%d. %s - %d XP", i, playerName, playerXP);
			SendClientMessage(playerid, -1, szMessage);
			i++;
	    }

	    return mysql_free_result();
	}

	return 1;
}
Reply
#2

So playerName is set to MAX_PLAYER_NAME, 24 characters long, and you've put a string specifier of 120 characters in your sscanf.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)