07.09.2012, 08:50
The Saving Stock
I also tried this
The Player Enum
Database Structure (http://www.vs-rp.com/db.png)

Database Players (http://www.vs-rp.com/dbacc.png)

The problem? I have no idea... :/
Everything is being saved as default.
(I have called 'SavePlayerAccount(playerid);' on the player disconnect. )
pawn Код:
stock SavePlayerAccount(playerid)
{
if(IsPlayerConnected(playerid))
{
new EscapedName[MAX_PLAYER_NAME];
mysql_real_escape_string(GetName(playerid), EscapedName);
//UpdatePlayerVariables(playerid);
if(CheckExist(playerid) == 0)
{
format(query, sizeof(query), "INSERT INTO `Accounts` (Username, Password) VALUES('%s', '%s')",EscapedName, Player[playerid][pPassword]);
mysql_query(query);
}
format(query, sizeof(query), "UPDATE Accounts SET AccountID=%d, Username='%s', Password='%s', Money=%d, Level=%d, Skin=%d, Health=%f, Armour=%f, PosX=%f, PosY=%f, PosZ=%f, Angle=%f, Ethnicity=%d, Gender=%d, Age=%d, DefaultSpawn=%d, PhoneType=%d, PhoneNumber=%d, World=%d, Interior=%d, VehSlots=%d, Admin=%d WHERE playerid=%d",
Player[playerid][pAccountID],Player[playerid][pUsername],Player[playerid][pPassword],Player[playerid][pMoney],Player[playerid][pLevel],Player[playerid][pSkin],Player[playerid][pHealth],Player[playerid][pArmour],
Player[playerid][pPosX],Player[playerid][pPosY],Player[playerid][pPosZ],Player[playerid][pAngle],Player[playerid][pEthnicity],Player[playerid][pGender],Player[playerid][pAge],Player[playerid][pDefaultSpawn],Player[playerid][pPhoneType],
Player[playerid][pPhoneNumber],Player[playerid][pWorld], Player[playerid][pInterior],Player[playerid][pVehSlots],Player[playerid][pAdmin],Player[playerid][pAccountID]);
mysql_query(query);
SaveContacts(playerid);
}
}
pawn Код:
format(query, sizeof(query), "UPDATE `Accounts` SET `Username` = '%s', `Password` = '%s', `Money` = '%d', `Level` = '%d', `Skin` = '%d' WHERE `AccountID` = '%d'", Player[playerid][pUsername], Player[playerid][pPassword], Player[playerid][pMoney], Player[playerid][pLevel], Player[playerid][pSkin], Player[playerid][pAccountID]);
mysql_query(query);
format(query,sizeof(query), "UPDATE `Accounts` SET `Health` = '%f', `Armour` = '%f', `PositionX` = '%f', `PositionY` = '%f', `PositionZ` = '%f', `Angle` = '%f' WHERE `AccountID` = '%d'", Player[playerid][pHealth],Player[playerid][pArmour],Player[playerid][pPosX],Player[playerid][pPosY],Player[playerid][pPosZ],Player[playerid][pAngle],Player[playerid][pAccountID]);
mysql_query(query);
format(query,sizeof(query), "UPDATE `Accounts` SET `Ethnicity` = '%d', `Gender` = '%d', `Age` = '%d', `Locked` = '%d', `DefaultSpawn` = '%d', `PhoneType` = '%d', `PhoneNumber` = '%d' WHERE `AccountID` = '%d'", Player[playerid][pEthnicity],Player[playerid][pEthnicity],Player[playerid][pAge],Player[playerid][pDefaultSpawn],Player[playerid][pPhoneType],Player[playerid][pPhoneNumber],Player[playerid][pAccountID]);
mysql_query(query);
format(query,sizeof(query), "UPDATE `Accounts` SET `World` = '%d', `Interior` = '%d', `VehSlots` = '%d', `Admin` = '%d', `AdminDuty` = '%d', WHERE `AccountID` = '%d'", Player[playerid][pWorld],Player[playerid][pInterior],Player[playerid][pVehSlots],Player[playerid][pAdmin],Player[playerid][pAdminDuty],Player[playerid][pAccountID]);
mysql_query(query);
SaveContacts(playerid);
pawn Код:
enum PlayerData
{
pAccountID,
pUsername[23],
pPassword[146],
pMoney,
pLevel,
pSkin,
Float:pHealth,
Float:pArmour,
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Float:pAngle,
pEthnicity,
pGender,
pAge,
pDefaultSpawn,
pPhoneType,
pPhoneNumber,
pWorld,
pInterior,
pVehSlots,
pAdmin,
pAdminDuty,
pJob,
pFaction
};

Database Players (http://www.vs-rp.com/dbacc.png)

The problem? I have no idea... :/
Everything is being saved as default.
(I have called 'SavePlayerAccount(playerid);' on the player disconnect. )