11.01.2012, 15:09
I've got an SQL database and system up and running, just one problem.
When I have got this:
I've added a few things to it: Here is what else I have:
And this:
In my SQL database, I have got all the required table things, with "DonatorLevel" "Skin" "Level" and things, but I just can't seem to get it to save/load them parts?
Is there anything I am missing?
Thanks.
All help is appreciated and Reputation will be rewarded.
When I have got this:
pawn Код:
enum _PSTATS
{
pLayaName[24],
pPassword[35],
pKills,
pDeaths,
pMoney,
pAdminLevel,
pSkin,
Float:pLastX,
Float:pLastY,
Float:pLastZ,
pInt,
pDonatorLevel,
pLevel // Add more info
}
new Player[MAX_PLAYERS][_PSTATS];
pawn Код:
stock SavePInfo(playerid)
{
if(GetPVarInt(playerid, "LoggedIN") == 1)
{
new Float:x, Float:y, Float: z;
GetPlayerPos(playerid, x, y, z);
new
Query[600];
format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d, `deaths` = %d, `money` = %d, `AdminLevel` = %d, `Skin` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d, `DonatorLevel` = %d, `Level` = %d WHERE `user` = '%s'",
Player[playerid][pKills],
Player[playerid][pDeaths],
GetPlayerMoney(playerid),
Player[playerid][pAdminLevel],
GetPlayerSkin(playerid),
x,
y,
z,
GetPlayerInterior(playerid),
Player[playerid][pDonatorLevel],
GetPlayerScore(playerid),
pName(playerid));
mysql_query(Query);
mysql_free_result();
return 1;
}
else return 0;
}
pawn Код:
stock LoadPlayerInfo(iPlayer)
{
new
Query[700];
if(mysql_fetch_row(Query))
{
mysql_query("SELECT * FROM `playerinfo`");
sscanf(Query, "e<p<|>s[24]s[35]dddddfffddd>", Player[iPlayer]); // Remember to update this if you add more info...
mysql_free_result();
GivePlayerMoney(iPlayer, Player[iPlayer][pMoney]);
SetPlayerScore(iPlayer, Player[iPlayer][pLevel]);
SetSpawnInfo(iPlayer, 0, Player[iPlayer][pSkin], Player[iPlayer][pLastX], Player[iPlayer][pLastY], Player[iPlayer][pLastZ], 90, 0, 0, 0, 0, 0, 0);
}
return 1;
}
Is there anything I am missing?
Thanks.
All help is appreciated and Reputation will be rewarded.