You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '6446766', `Savings` = '0', `PlayingHours` = '0', `plaUpgrade` = '0', `DonateRank' at line 1 (cs.pwn:9628 -> cs.pwn:9456 -> cs.pwn:9999 -> C:\Users\AccountName\Desktop\Testing But again\pawno\include\YSI\y_iterate.inc:909 -> C:\Users\AccountName\Desktop\Testing But again\pawno\include\sscanf2.inc:260 -> C:\Users\AccountName\Desktop\Testing But again\pawno\include\nex-ac.inc:2945)
There is more code before this but I dont find it relevant. format(query, sizeof(query), "%s, `Jailtime2` = %d, `ADPoint` = '%d', `WepLic` = '%d', `PrimaryLicense` = '%d', `SecondaryLicense` = '%d', `CCWLicense` = '%d', `playerSWAT` = '%d',`Tester` = '%d'", query, PlayerData[playerid][pJailTime2], PlayerData[playerid][pADPoint], PlayerData[playerid][pWepLic], PlayerData[playerid][pPLicense], PlayerData[playerid][pSLicense], PlayerData[playerid][pCCWLic], PlayerData[playerid][pSwat], PlayerData[playerid][pTester] ); format(query, sizeof(query), "%s WHERE `ID` = '%d'", query, PlayerData[playerid][pID] ); mysql_query(dbCon, query); printf("Save Player ID %d: %d", playerid, strlen(query));
if (SQL_IsLogged(playerid)) { SQL_SaveCharacter(playerid); RunDisconnect(playerid); } ResetStatistics(playerid); return 1;
stock RunDisconnect(playerid) { if(AccountData[playerid][aConnectionID]) { new query[128]; format(query,sizeof(query),"UPDATE logs_connection SET disconnected = NOW() WHERE id = '%d'",AccountData[playerid][aConnectionID]); mysql_query(dbCon, query); } }
public OnPlayerDisconnect(playerid, reason) { new str[128]; /*PlayerData[playerid][pLeaveTime] = GetTickCount(); format(PlayerData[playerid][pLeaveIP], 16, PlayerData[playerid][pIP]); */ new szDisconnectReason[3][] = {"Timeout","Leaving","Kicked"}; format(str, sizeof str, "*** %s Left the server (%s)", ReturnName(playerid), szDisconnectReason[reason]); ProxJoinServer(playerid, 20.0, str); if(reason == 0) PlayerData[playerid][pTimeout]= gettime(); TerminateConnection(playerid); return 1; }
&& defined ac_OnPlayerDisconnect return ac_OnPlayerDisconnect(playerid, reason);
You don't find it relevant but it IS relevant. Post the whole query.
|
SQL_SaveCharacter(playerid) { if (!SQL_IsLogged(playerid)) return 0; new query[2048]; if (GetPlayerState(playerid) != PLAYER_STATE_SPECTATING && PlayerData[playerid][pTimeout] || PlayerData[playerid][pInjured] || PlayerData[playerid][pJailed]) { PlayerData[playerid][pInterior] = GetPlayerInterior(playerid); PlayerData[playerid][pWorld] = GetPlayerVirtualWorld(playerid); GetPlayerPos(playerid, PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2]); GetPlayerFacingAngle(playerid, PlayerData[playerid][pPos][3]); format(query, sizeof(query), "UPDATE `characters` SET `OnDuty` = '%d', `PosX` = '%.4f', `PosY` = '%.4f', `PosZ` = '%.4f', `PosA` = '%.4f', `Interior` = '%d', `World` = '%d', `Local` = '%d'", PlayerData[playerid][pOnDuty], PlayerData[playerid][pPos][0], PlayerData[playerid][pPos][1], PlayerData[playerid][pPos][2], PlayerData[playerid][pPos][3], PlayerData[playerid][pInterior], PlayerData[playerid][pWorld], PlayerData[playerid][pLocal] ); if(GetPVarInt(playerid, "WeaponSlot2")) { PlayerData[playerid][pGuns][2] = 24; PlayerData[playerid][pAmmo][2] = GetPVarInt(playerid, "WeaponSlot2"); DeletePVar(playerid, "WeaponSlot2"); } for (new i = 0; i < 13; i ++) { format(query, sizeof(query), "%s, `WpGun%d` = '%d', `WpAmmo%d` = '%d'", query, i + 1, PlayerData[playerid][pGuns][i], i + 1, PlayerData[playerid][pAmmo][i]); } format(query, sizeof(query), "%s WHERE `ID` = '%d'", query, PlayerData[playerid][pID] ); mysql_query(dbCon, query); } if(PlayerData[playerid][pOOCMask] && !PlayerData[playerid][pDonateRank]) PlayerData[playerid][pOOCMask] = 0; GetPlayerArmour(playerid, PlayerData[playerid][pArmour]); //GetPlayerHealth(playerid, PlayerData[playerid][pHealth]); format(query, sizeof(query), "UPDATE `characters` SET `Character` = '%s'", PlayerData[playerid][pName] ); format(query, sizeof(query), "UPDATE `characters` SET `Created` = '%d', `Gender` = '%d', `Birthdate` = '%d', `Origin` = '%s', `Model` = '%d', `Char` = '%d', `PhoneNumbr` = '%d', `PhoneModel` = '%d', `SpawnPoint` = '%d', `SpawnType` = '%d', `Admin` = '%d', `Level` = '%d', `Exp` = '%d', `PayDay` = '%d', `PayDayHad` = '%d', `PayCheck` = '%d', `ChequeCash` = '%d', `Injured` = '%d', `playerTimeout` = '%d', `MedicBill` = '%d', `Armour` = '%f', `Health` = '%f', `Hunger` = '%f', `FightStyle` = '%d'", PlayerData[playerid][pCreated], PlayerData[playerid][pGender], PlayerData[playerid][pBirthdate], PlayerData[playerid][pOrigin], PlayerData[playerid][pModel], PlayerData[playerid][pChar], PlayerData[playerid][pPnumber], PlayerData[playerid][pPmodel], PlayerData[playerid][pSpawnPoint], PlayerData[playerid][pSpawnType], PlayerData[playerid][pAdmin], PlayerData[playerid][pLevel], PlayerData[playerid][pExp], PlayerData[playerid][pPayDay], PlayerData[playerid][pPayDayHad], PlayerData[playerid][pPayCheck], PlayerData[playerid][pChequeCash], PlayerData[playerid][pInjured], PlayerData[playerid][pTimeout], MedicBill[playerid], PlayerData[playerid][pArmour], PlayerData[playerid][pHealth], PlayerData[playerid][pHunger], PlayerData[playerid][pFightStyle] ); format(query, sizeof(query), "%s, `BankAccount` = '%d, `Cash` = '%d', `Savings` = '%d', `PlayingHours` = '%d', `plaUpgrade` = '%d', `DonateRank` = '%d', `AlcoholPerk` = '%d', `DrugPerk` = '%d', `MiserPerk` = '%d', `PainPerk` = '%d', `TraderPerk` = '%d', `SpawnHealth` = '%f', `PhoneSilent` = '%d', `PhoneAir` = '%d', `PhoneRingtone` = '%d', `PhoneTextRingtone` = '%d', `Faction` = '%d', `FactionRank` = '%d', `Gun1` = '%d', `Gun2` = '%d', `Gun3` = '%d', `Ammo1` = '%d', `Ammo2` = '%d', `Ammo3` = '%d'", query, PlayerData[playerid][pAccount], PlayerData[playerid][pCash], PlayerData[playerid][pSavings], PlayerData[playerid][pPlayingHours], PlayerData[playerid][pPUpgrade], PlayerData[playerid][pDonateRank], PlayerData[playerid][pAlcoholPerk], PlayerData[playerid][pDrugPerk], PlayerData[playerid][pMiserPerk], PlayerData[playerid][pPainPerk], PlayerData[playerid][pTraderPerk], PlayerData[playerid][pSHealth], // ================== [ PHONE SYSTEM ] ============================ , `PhoneSilent` = '%d', `PhoneAir` = '%d', `PhoneRingtone` = '%d' ph_silentmode[playerid], ph_airmode[playerid], ph_CallTone[playerid], ph_TextTone[playerid], // ================== [ PHONE SYSTEM ] ============================ PlayerData[playerid][pFactionID], PlayerData[playerid][pFactionRank], PlayerData[playerid][pGun1], PlayerData[playerid][pGun2], PlayerData[playerid][pGun3], PlayerData[playerid][pAmmo1], PlayerData[playerid][pAmmo2], PlayerData[playerid][pAmmo3] ); format(query, sizeof(query), "%s, `Radio` = '%d', `RadioChannel` = '%d', `RadioSlot` = '%d', `RadioAuth` = '%s', `playerJob` = '%d', `playerSideJob` = '%d', `playerJobRank` = '%d', `playerCareer` = '%d', `playerHouseKey` = '%d', `PlayerBusinessKey` = '%d', `PlayerCarkey` = '%d', `Checkpoint_Type` = '%d', `Checkpoint_X` = '%f', `Checkpoint_Y` = '%f', `Checkpoint_Z` = '%f', `Fishes` = '%d', `SavingsCollect` = '%d', `ContractTime` = '%d', `OOCMask` = '%d',`Jailed` = %d, `Jailtime` = %d, `CarLic` = %d", query, PlayerData[playerid][pRadio], PlayerData[playerid][pRChannel], PlayerData[playerid][pRSlot], PlayerData[playerid][pRAuth], PlayerData[playerid][pJob], PlayerData[playerid][pSideJob], PlayerData[playerid][pJobRank], PlayerData[playerid][pCareer], PlayerData[playerid][pHouseKey], PlayerData[playerid][pPbiskey], PlayerData[playerid][pPCarkey], PlayerData[playerid][pCP_Type], PlayerData[playerid][pCP_X], PlayerData[playerid][pCP_Y], PlayerData[playerid][pCP_Z], PlayerData[playerid][pFishes], PlayerData[playerid][pSavingsCollect], PlayerData[playerid][pContractTime], PlayerData[playerid][pOOCMask], PlayerData[playerid][pJailed], PlayerData[playerid][pJailTime], PlayerData[playerid][pCarLic] ); format(query, sizeof(query), "%s, `Jailtime2` = %d, `ADPoint` = '%d', `WepLic` = '%d', `PrimaryLicense` = '%d', `SecondaryLicense` = '%d', `CCWLicense` = '%d', `playerSWAT` = '%d',`Tester` = '%d'", query, PlayerData[playerid][pJailTime2], PlayerData[playerid][pADPoint], PlayerData[playerid][pWepLic], PlayerData[playerid][pPLicense], PlayerData[playerid][pSLicense], PlayerData[playerid][pCCWLic], PlayerData[playerid][pSwat], PlayerData[playerid][pTester] ); format(query, sizeof(query), "%s WHERE `ID` = '%d'", query, PlayerData[playerid][pID] ); mysql_query(dbCon, query); printf("Save Player ID %d: %d", playerid, strlen(query)); for (new x = 0; x < MAX_SMS; x ++) { if(SmsData[playerid][x][smsExist]) { format(query, sizeof(query), "UPDATE `phone_sms` SET `Archive` = %d,`ReadSMS` = %d WHERE `id` = %d", SmsData[playerid][x][smsArchive], SmsData[playerid][x][smsRead], SmsData[playerid][x][smsID]); mysql_query(dbCon, query); } } for (new id = 0; id < MAX_CLOTHES; id ++) { if(ClothingData[playerid][id][cl_object]) { format(query,sizeof(query),"UPDATE clothing SET object = '%d', bone = '%d', slot = '%d', equip = '%d', name = '%s' WHERE id = '%d' AND owner = '%d' LIMIT 1", ClothingData[playerid][id][cl_object], ClothingData[playerid][id][cl_bone], ClothingData[playerid][id][cl_slot], ClothingData[playerid][id][cl_equip], ClothingData[playerid][id][cl_name], ClothingData[playerid][id][cl_sid], PlayerData[playerid][pID]); mysql_query(dbCon, query); } } /*new housekey = PlayerData[playerid][pHouseKey]; if(housekey != -1) UpdateHouseInfo(housekey);*/ //printf("%d",strlen(query)); return 1; }
`BankAccount` = '%d, `Cash` = '%d', `Savings` = '%d'
Code:
`BankAccount` = '%d, `Cash` = '%d', `Savings` = '%d' On another note, you save everything at once — this is wrong. Do birthday or admin change every single time a player disconnects? No, so update them only when they change and remove them from the query. This rule applies for all of them. Update only what changes values. |