01.10.2013, 16:34
Alright, so currently I'm trying to learn how to use MySql so I decided to download a base MySql RP script that I could work with, and at the moment I'm having problems with the loading part.
I get the sscanf warning format specifier doesn't match parameter count.
So here's the code:
Used for loading:
Enum:
And the loading:
So yeah, I just get In Game, get that warning, and everything gets mixed up. I checked
"p<|>ds[24]s[64]s[16]s[32]ddddffffdddddffddddddddds[20]>"
a few times, and it seems to have all the parameters as enum. (Ignore the Local Data ones as it's used for ones in MySql).
If anything else is needed, please tell me
I get the sscanf warning format specifier doesn't match parameter count.
So here's the code:
Used for loading:
pawn Код:
#define mysql_user_string "p<|>ds[24]s[64]s[16]s[32]ddddffffdddddffddddddddds[20]>"
pawn Код:
enum pInfo
{
//Saving Data
pID,
pName[MAX_PLAYER_NAME],
pPassword[MAX_PASSWORD_LEN],
pIP[16],
pCountry[MAX_COUNTRY_LEN],
pGender,
pScore,
pMoney,
pIsNew,
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Float:pPosR,
pFightStyle,
pSkin,
pBanned,
pAdmin,
pVip,
Float:pArmour,
Float:pHealth,
pInterior,
pWantedLevel,
pKills,
pDeaths,
pVirtualWorld,
pLocked,
pHelper,
pMuted,
pConnectedTime,
pLastLogin[20],
// Local Data
pLoggedIn,
pRegistered,
pSpawned,
pQuestionIdx,
pQuestions
}
pawn Код:
stock LoadAccount(playerid)
{
new Escape[2][MAX_PLAYER_NAME];
mysql_real_escape_string(PlayerInfo[playerid][pName], Escape[0]);
mysql_real_escape_string(mysql_account_table, Escape[1]);
format(query, sizeof(query), "SELECT * FROM `%s` WHERE `username` = '%s'", Escape[1], Escape[0]);
mysql_query(query);
mysql_store_result();
if(mysql_num_rows())
{
if(mysql_fetch_row(largestr))
{
if(!sscanf(largestr, mysql_user_string, PlayerInfo[playerid]))
{
PlayerInfo[playerid][pLoggedIn] = 1;
PlayerInfo[playerid][pRegistered] = 1;
PlayerInfo[playerid][pIsNew] = 0;
printf("[DEBUG]: Player %s(%d) Stats loaded!", PlayerInfo[playerid][pName], playerid);
return 1;
}
format(str, sizeof(str), "Player %s(%d) - SSCANF loading error", PlayerInfo[playerid][pName], playerid);
Error("MYSQL", str);
AccountError(playerid);
mysql_free_result();
return 1;
}
format(str, sizeof(str), "Player %s(%d) - Cannot fetch player row", PlayerInfo[playerid][pName], playerid);
Error("MYSQL", str);
AccountError(playerid);
mysql_free_result();
return 1;
}
format(str, sizeof(str), "Player %s(%d) - Cannot find player in the mysql database", PlayerInfo[playerid][pName], playerid);
Error("MYSQL", str);
AccountError(playerid);
mysql_free_result();
return 1;
}
"p<|>ds[24]s[64]s[16]s[32]ddddffffdddddffddddddddds[20]>"
a few times, and it seems to have all the parameters as enum. (Ignore the Local Data ones as it's used for ones in MySql).
If anything else is needed, please tell me
