PDA

View Full Version : Help me... Save Data


CoR3
14/02/2015, 10:30 PM
Hello, i have a save data system, but now i have some mistakes with this system.
This is my complete code, but error is only in one part.

"Pawn doesn't show me alerts or errors, but the code doesn't work completely."

forward OnPlayerDataSave(playerid);
public OnPlayerDataSave(playerid)
{
if(IsPlayerNPC(playerid)) return 1;
if(IsPlayerConnected(playerid) == 1 && gPlayerLogged[playerid] == 1 || JustReg[playerid] == 1)
{
JustReg[playerid] = 0;
TelePos[playerid][0] = 0.0;
TelePos[playerid][1] = 0.0;
new string[1024];
if(AccountExists(PlayerName(playerid)))
{
SaveToMysql(PlayerInfo[playerid][pPassword]);
SaveToMysql(PlayerInfo[playerid][pMarriedTo]);
SaveToMysql(PlayerInfo[playerid][pTaunt]);
SaveToMysql(PlayerInfo[playerid][pBanReason]);
SaveToMysql(PlayerInfo[playerid][pFishes1]);
SaveToMysql(PlayerInfo[playerid][pFishes2]);
SaveToMysql(PlayerInfo[playerid][pFishes3]);
SaveToMysql(PlayerInfo[playerid][pFishes4]);
SaveToMysql(PlayerInfo[playerid][pFishes5]);
SaveToMysql(PlayerInfo[playerid][pAccent]);
SaveToMysql(PlayerInfo[playerid][pAdmName]);
SaveToMysql(PlayerInfo[playerid][pTicketReason0]);
SaveToMysql(PlayerInfo[playerid][pTicketReason1]);
SaveToMysql(PlayerInfo[playerid][pTicketReason2]);
SaveToMysql(PlayerInfo[playerid][pTicketReason3]);
SaveToMysql(PlayerInfo[playerid][pTicketReason4]);
SaveToMysql(PlayerInfo[playerid][pApp]);
SaveToMysql(PlayerInfo[playerid][pWarrantReason]);

PlayerInfo[playerid][pCash] = GetPlayerPCash(playerid);
new Float:armour;
new Float:health;
GetPlayerArmour(playerid,armour);
PlayerInfo[playerid][pCrashArmour] = armour;
GetPlayerHealth(playerid,health);
PlayerInfo[playerid][pCrashHealth] = health;
if(IsDead[playerid] == 2)
{
PlayerInfo[playerid][pCrashHealth] = 0;
IsDead[playerid] = 0;
AfterLife(playerid);
}

format(string, sizeof(string), "UPDATE players SET `Cash`=%d,`Account`=%d,`AdminLevel`=%d,`Level`=%d, `Respect`=%d,`Kills`=%d,`Gun1`=%d,`Gun2`=%d,`Gun3` =%d,`Gun4`=%d,`Gun5`=%d,`Gun6`=%d,`Ammo1`=%d,`Ammo 2`=%d,`Ammo3`=%d,`Ammo4`=%d,`Ammo5`=%d,`Ammo6`=%d, `pSHealth`=%f,`Health`=%f,`Pos_x`=%f,`Pos_y`=%f,`P os_z`=%f,`Int`=%d,`Local`=%d,`Team`=%d,`Char`=%d,` PhoneNr`=%d,`pHouseKey`=%d,`Bizz`=%d WHERE `Name` = '%s'",
PlayerInfo[playerid][pCash],
PlayerInfo[playerid][pAccount],
PlayerInfo[playerid][pAdmin],
PlayerInfo[playerid][pLevel],
PlayerInfo[playerid][pExp],
PlayerInfo[playerid][pKills],
PlayerInfo[playerid][pGun1],
PlayerInfo[playerid][pGun2],
PlayerInfo[playerid][pGun3],
PlayerInfo[playerid][pGun4],
PlayerInfo[playerid][pGun5],
PlayerInfo[playerid][pGun6],
PlayerInfo[playerid][pAmmo1],
PlayerInfo[playerid][pAmmo2],
PlayerInfo[playerid][pAmmo3],
PlayerInfo[playerid][pAmmo4],
PlayerInfo[playerid][pAmmo5],
PlayerInfo[playerid][pAmmo6],
PlayerInfo[playerid][pSHealth],
PlayerInfo[playerid][pHealth],
PlayerInfo[playerid][pPos_x],
PlayerInfo[playerid][pPos_y],
PlayerInfo[playerid][pPos_z],
PlayerInfo[playerid][pInt],
PlayerInfo[playerid][pLocal],
PlayerInfo[playerid][pTeam],
PlayerInfo[playerid][pModel],
PlayerInfo[playerid][pPnumber],
PlayerInfo[playerid][pHousekey],
PlayerInfo[playerid][pPbiskey],
PlayerName(playerid));
mysql_query_ex(string);

format(string, sizeof(string), "UPDATE players SET `Banned`=%d,`FightSkill`=%d, `HotwireSkill`=%d,`Sex`=%d,`Age`=%d,`Member`=%d,`R ank`=%d,`Crashed`=%d,`Job`=%d,`HouseEntered`=%d,`I ntEntered`=%d,`CrashHealth`=%f,`CrashArmour`=%f,`W orld`=%d,`PayCheck`=%d,`DonateRank`=%d,`ConnectTim e`=%d,`DonateTime`=%d,`Jailed`=%d,`JailTime`=%d,`D rugs`=%d,`Materials`=%d,`VaultOwned`=%d,`VaultDrug s`=%d,`VaultMats`=%d WHERE `Name` = '%s'",
PlayerInfo[playerid][pBanned],
PlayerInfo[playerid][pFightSkill],
PlayerInfo[playerid][pHotwireSkill],
PlayerInfo[playerid][pSex],
PlayerInfo[playerid][pAge],
PlayerInfo[playerid][pMember],
PlayerInfo[playerid][pRank],
PlayerInfo[playerid][pCrashed],
PlayerInfo[playerid][pJob],
HouseEntered[playerid],
IntEntered[playerid],
PlayerInfo[playerid][pCrashHealth],
PlayerInfo[playerid][pCrashArmour],
PlayerInfo[playerid][pWorld],
PlayerInfo[playerid][pPayCheck],
PlayerInfo[playerid][pDonateRank],
PlayerInfo[playerid][pConnectTime],
PlayerInfo[playerid][pDonateTime],
PlayerInfo[playerid][pJailed],
PlayerInfo[playerid][pJailTime],
PlayerInfo[playerid][pDrugs],
PlayerInfo[playerid][pMats],
PlayerInfo[playerid][pVaultOwned],
PlayerInfo[playerid][pVaultDrugs],
PlayerInfo[playerid][pVaultMats],
PlayerName(playerid));
mysql_query_ex(string);

format(string, sizeof(string), "UPDATE players SET `Watch`=%d,`PhoneBook`=%d,`Mask`=%d,`CarLic`=%d,`C ar`=%d,`Car2`=%d,`Car3`=%d,`Married`=%d,`Helper`=% d,`WantedLevel`=%d,`GunLic`=%d,`Crimes`=%d,`Arrest ed`=%d,`MarriedTo`='%s',`Taunt`='%s',`InvWeapon`=% d,`InvAmmo`=%d,`InvBeer`=%d,`InvWine`=%d,`InvCiggy `=%d,`Hidden`=%d,`Walkie`=%d,`WalkieFreq`=%d,`Ligh ter`=%d,`Cigs`=%d,`BanReason`='%s' WHERE `Name` = '%s'",
PlayerInfo[playerid][pWatch],
PlayerInfo[playerid][pPhoneBook],
PlayerInfo[playerid][pMask],
PlayerInfo[playerid][pDrivLic],
PlayerInfo[playerid][pCarkey],
PlayerInfo[playerid][pCarkey2],
PlayerInfo[playerid][pCarkey3],
PlayerInfo[playerid][pMarried],
PlayerInfo[playerid][pHelper],
WantedLevel[playerid],
PlayerInfo[playerid][pGunLic],
PlayerInfo[playerid][pCrimes],
PlayerInfo[playerid][pArrested],
PlayerInfo[playerid][pMarriedTo],
PlayerInfo[playerid][pTaunt],
PlayerInfo[playerid][pInvWeapon],
PlayerInfo[playerid][pInvAmmo],
PlayerInfo[playerid][pInvBeer],
PlayerInfo[playerid][pInvWine],
PlayerInfo[playerid][pInvCiggy],
PlayerInfo[playerid][pHidden],
PlayerInfo[playerid][pWalkie],
PlayerInfo[playerid][pWalkieFreq],
PlayerInfo[playerid][pLighter],
PlayerInfo[playerid][pCigs],
PlayerInfo[playerid][pBanReason],
PlayerName(playerid));
mysql_query_ex(string);

format(string, sizeof(string), "UPDATE players SET `Fishes1`='%s',`Fishes2`='%s',`Fishes3`='%s',`Fish es4`='%s',`Fishes5`='%s',`Fish1`=%d,`Fish2`=%d,`Fi sh3`=%d,`Fish4`=%d,`Fish5`=%d,`MaskUse`=%d,`Accent `='%s',`Voted2`=%d,`AdmName`='%s',`HeadValue`=%d,` HiddenNum`=%d,`Skate`=%d WHERE `Name`='%s'",
PlayerInfo[playerid][pFishes1],
PlayerInfo[playerid][pFishes2],
PlayerInfo[playerid][pFishes3],
PlayerInfo[playerid][pFishes4],
PlayerInfo[playerid][pFishes5],
PlayerInfo[playerid][pFish][0],
PlayerInfo[playerid][pFish][1],
PlayerInfo[playerid][pFish][2],
PlayerInfo[playerid][pFish][3],
PlayerInfo[playerid][pFish][4],
PlayerInfo[playerid][pMaskUse],
PlayerInfo[playerid][pAccent],
PlayerInfo[playerid][pVoted],
PlayerInfo[playerid][pAdmName],
PlayerInfo[playerid][pHeadValue],
PlayerInfo[playerid][pHiddenNum],
PlayerInfo[playerid][pSkate],
PlayerName(playerid));
mysql_query_ex(string);

format(string, sizeof(string), "UPDATE players SET `Radio`=%d,`Ticket0`=%d,`Ticket1`=%d,`Ticket2`=%d, `Ticket3`=%d,`Ticket4`=%d,`TicketReason0`='%s',`Ti cketReason1`='%s',`TicketReason2`='%s',`TicketReas on3`='%s',`TicketReason4`='%s',`App`='%s',`Changes `=%d,`FamNum`=%d,`Cellphone`=%d,`Celltime`=%d,`Cel lplan`=%d,`DonerGate1`=%d,`BreakAllow`=%d,`FurnLoc ked`=%d,`DonateCarDate`=%d,`Warrant`=%d,`WarrantRe ason`='%s',`FactionIdent`=%d,`LockTime`=%d, `Dudas`=%d , `Hunger`=%d WHERE `Name`='%s'",
PlayerInfo[playerid][pRadio],
PlayerInfo[playerid][pTicket][0],
PlayerInfo[playerid][pTicket][1],
PlayerInfo[playerid][pTicket][2],
PlayerInfo[playerid][pTicket][3],
PlayerInfo[playerid][pTicket][4],
PlayerInfo[playerid][pTicketReason0],
PlayerInfo[playerid][pTicketReason1],
PlayerInfo[playerid][pTicketReason2],
PlayerInfo[playerid][pTicketReason3],
PlayerInfo[playerid][pTicketReason4],
PlayerInfo[playerid][pApp],
PlayerInfo[playerid][pChanges],
PlayerInfo[playerid][pFamNum],
PlayerInfo[playerid][pCellphone],
PlayerInfo[playerid][pCelltime],
PlayerInfo[playerid][pCellplan],
PlayerInfo[playerid][pDonerGate1],
BreakAllow[playerid],
PlayerInfo[playerid][pFurnLocked],
PlayerInfo[playerid][pDonatorCarDate],
PlayerInfo[playerid][pWarrant],
PlayerInfo[playerid][pWarrantReason],
PlayerInfo[playerid][pFactionIden],
PlayerInfo[playerid][pLockTime],
PlayerInfo[playerid][pDudas],
PlayerInfo[playerid][pHunger],
PlayerName(playerid));
mysql_query_ex(string);

format(string, sizeof(string), "UPDATE players SET `Gafas`=%d,`Dcoins`=%d,`Narmero`=%d,`Earmero`=%d,` Medicamentos`=%d,`Ncamionero`=%d,`Ecamionero`=%d,` Licheli`=%d WHERE `Name`='%s'",
PlayerInfo[playerid][pGafas],
PlayerInfo[playerid][pDcoins],
PlayerInfo[playerid][pNarmero],
PlayerInfo[playerid][pEarmero],
PlayerInfo[playerid][pMedicamentos],
PlayerInfo[playerid][pNcamionero],
PlayerInfo[playerid][pEcamionero],
PlayerInfo[playerid][pLicheli],
PlayerName(playerid));
mysql_query_ex(string);

LoadFromMysql(PlayerInfo[playerid][pPassword]);
LoadFromMysql(PlayerInfo[playerid][pMarriedTo]);
LoadFromMysql(PlayerInfo[playerid][pTaunt]);
LoadFromMysql(PlayerInfo[playerid][pBanReason]);
LoadFromMysql(PlayerInfo[playerid][pFishes1]);
LoadFromMysql(PlayerInfo[playerid][pFishes2]);
LoadFromMysql(PlayerInfo[playerid][pFishes3]);
LoadFromMysql(PlayerInfo[playerid][pFishes4]);
LoadFromMysql(PlayerInfo[playerid][pFishes5]);
LoadFromMysql(PlayerInfo[playerid][pAccent]);
LoadFromMysql(PlayerInfo[playerid][pAdmName]);
LoadFromMysql(PlayerInfo[playerid][pTicketReason0]);
LoadFromMysql(PlayerInfo[playerid][pTicketReason1]);
LoadFromMysql(PlayerInfo[playerid][pTicketReason2]);
LoadFromMysql(PlayerInfo[playerid][pTicketReason3]);
LoadFromMysql(PlayerInfo[playerid][pTicketReason4]);
LoadFromMysql(PlayerInfo[playerid][pApp]);
LoadFromMysql(PlayerInfo[playerid][pWarrantReason]);
}
}

return 1;
}


Everything is saved fine except this part:

format(string, sizeof(string), "UPDATE players SET `Gafas`=%d,`Dcoins`=%d,`Narmero`=%d,`Earmero`=%d,` Medicamentos`=%d,`Ncamionero`=%d,`Ecamionero`=%d,` Licheli`=%d WHERE `Name`='%s'",
PlayerInfo[playerid][pGafas],
PlayerInfo[playerid][pDcoins],
PlayerInfo[playerid][pNarmero],
PlayerInfo[playerid][pEarmero],
PlayerInfo[playerid][pMedicamentos],
PlayerInfo[playerid][pNcamionero],
PlayerInfo[playerid][pEcamionero],
PlayerInfo[playerid][pLicheli],
PlayerName(playerid));
mysql_query_ex(string);