09.10.2013, 13:03
Hi there,
Recently I've been attempting to create an auto-saving function for my server that'll save all the player's variables as soon as he disconnects & at every Payday. However, I've had some issues, here's the Debug.txt for the issue:
I've been trying to do a lot of stuff to try and get this to work, but I simply can't. The following code is the saving function that I've been using:
Any help would be appreciated, thanks.
Recently I've been attempting to create an auto-saving function for my server that'll save all the player's variables as soon as he disconnects & at every Payday. However, I've had some issues, here's the Debug.txt for the issue:
Quote:
[14:07:47] CMySQLHandler::Query(1|testacc1|ec7a040055a4b2b5ca f07d58420239e64b8ca80b|1|0|6|3|0|0|1|0|0|0|0|0|0|0 |0|0|0|0|0|0|0|0|0|0|-1|-1|0|-1|-1|-1|-1|0|0|0|0|0|0|0|0|0|0|0) - An error has occured. (Error ID: 1064, You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1|testacc1|ec7a040055a4b2b5caf07d58420239e64b8ca8 0b|1|0|6|3|0|0|1|0|0|0|0|0|0|0|0|0|' at line 1) |
pawn Код:
public UpdateAccount(playerid)
{
GetPlayerName(playerid, sender, sizeof(sender));
new updatequery[1000];
new string[100];
new level = PlayerData[playerid][pLevel];
new respect = PlayerData[playerid][pRespect];
new admin = PlayerData[playerid][pAdmin];
new helper = PlayerData[playerid][pHelper];
new premium = PlayerData[playerid][pPremium];
new sex = PlayerData[playerid][pSex];
new muted = PlayerData[playerid][pMuted];
new jailed = PlayerData[playerid][pJailed];
new ajailed = PlayerData[playerid][pAJailed];
new cash = PlayerData[playerid][pCash];
new bank = PlayerData[playerid][pBank];
new crimes = PlayerData[playerid][pCrimes];
new kills = PlayerData[playerid][pKills];
new deaths = PlayerData[playerid][pDeaths];
new arrested = PlayerData[playerid][pArrested];
new wanteddeaths = PlayerData[playerid][pWantedDeaths];
new phonebook = PlayerData[playerid][pPhoneBook];
new job = PlayerData[playerid][pJob];
new contract = PlayerData[playerid][pContract];
new materials = PlayerData[playerid][pMaterials];
new drugs = PlayerData[playerid][pDrugs];
new member = PlayerData[playerid][pFaction];
new rank = PlayerData[playerid][pRank];
new skin = PlayerData[playerid][pSkin];
new fskin = PlayerData[playerid][pFSkin];
new credit = PlayerData[playerid][pCredit];
new number = PlayerData[playerid][pNumber];
new house = PlayerData[playerid][pHouse];
new rent = PlayerData[playerid][pRent];
new business = PlayerData[playerid][pBusiness];
new hoursplayed = PlayerData[playerid][pHoursPlayed];
new carlicense = PlayerData[playerid][pCarLicense];
new boatlicense = PlayerData[playerid][pBoatLicense];
new flyinglicense = PlayerData[playerid][pFlyingLicense];
new bikelicense = PlayerData[playerid][pBikeLicense];
new weaponlicense = PlayerData[playerid][pWeaponLicense];
new materialslicense = PlayerData[playerid][pMaterialsLicense];
new warns = PlayerData[playerid][pWarns];
new fwarns = PlayerData[playerid][pFWarns];
new wantedlevel = PlayerData[playerid][pWantedLevel];
new newbie = PlayerData[playerid][pNewbieChat];
format(updatequery, sizeof(updatequery), "UPDATE `rp_users` SET");
format(string, sizeof(string), " `user_level`='%d',", level);
strcat(updatequery, string);
format(string, sizeof(string), " `user_respect`='%d',", respect);
strcat(updatequery, string);
format(string, sizeof(string), " `user_admin`='%d',", admin);
strcat(updatequery, string);
format(string, sizeof(string), " `user_helper`='%d',", helper);
strcat(updatequery, string);
format(string, sizeof(string), " `user_premium`='%d',", premium);
strcat(updatequery, string);
format(string, sizeof(string), " `user_sex`='%d',", sex);
strcat(updatequery, string);
format(string, sizeof(string), " `user_muted`='%d',", muted);
strcat(updatequery, string);
format(string, sizeof(string), " `user_jailed`='%d',", jailed);
strcat(updatequery, string);
format(string, sizeof(string), " `user_ajailed`='%d',", ajailed);
strcat(updatequery, string);
format(string, sizeof(string), " `user_cash`='%d',", cash);
strcat(updatequery, string);
format(string, sizeof(string), " `user_bank`='%d',", bank);
strcat(updatequery, string);
format(string, sizeof(string), " `user_crimes`='%d',", crimes);
strcat(updatequery, string);
format(string, sizeof(string), " `user_kills`='%d',", kills);
strcat(updatequery, string);
format(string, sizeof(string), " `user_deaths`='%d',", deaths);
strcat(updatequery, string);
format(string, sizeof(string), " `user_arrested`='%d',", arrested);
strcat(updatequery, string);
format(string, sizeof(string), " `user_wanteddeaths`='%d',", wanteddeaths);
strcat(updatequery, string);
format(string, sizeof(string), " `user_phonebook`='%d',", phonebook);
strcat(updatequery, string);
format(string, sizeof(string), " `user_job`='%d',", job);
strcat(updatequery, string);
format(string, sizeof(string), " `user_contract`='%d',", contract);
strcat(updatequery, string);
format(string, sizeof(string), " `user_materials`='%d',", materials);
strcat(updatequery, string);
format(string, sizeof(string), " `user_drugs`='%d',", drugs);
strcat(updatequery, string);
format(string, sizeof(string), " `user_member`='%d',", member);
strcat(updatequery, string);
format(string, sizeof(string), " `user_rank`='%d',", rank);
strcat(updatequery, string);
format(string, sizeof(string), " `user_skin`='%d',", skin);
strcat(updatequery, string);
format(string, sizeof(string), " `user_fskin`='%d',", fskin);
strcat(updatequery, string);
format(string, sizeof(string), " `user_credit`='%d',", credit);
strcat(updatequery, string);
format(string, sizeof(string), " `user_number`='%d',", number);
strcat(updatequery, string);
format(string, sizeof(string), " `user_house`='%d',", house);
strcat(updatequery, string);
format(string, sizeof(string), " `user_rent`='%d',", rent);
strcat(updatequery, string);
format(string, sizeof(string), " `user_business`='%d',", business);
strcat(updatequery, string);
format(string, sizeof(string), " `user_hoursplayed`='%d',", hoursplayed);
strcat(updatequery, string);
format(string, sizeof(string), " `user_carlicense`='%d',", carlicense);
strcat(updatequery, string);
format(string, sizeof(string), " `user_boatlicense`='%d',", boatlicense);
strcat(updatequery, string);
format(string, sizeof(string), " `user_flyinglicense`='%d',", flyinglicense);
strcat(updatequery, string);
format(string, sizeof(string), " `user_bikelicense`='%d',", bikelicense);
strcat(updatequery, string);
format(string, sizeof(string), " `user_weaponlicense`='%d',", weaponlicense);
strcat(updatequery, string);
format(string, sizeof(string), " `user_materialslicense`='%d',", materialslicense);
strcat(updatequery, string);
format(string, sizeof(string), " `user_warns`='%d',", warns);
strcat(updatequery, string);
format(string, sizeof(string), " `user_fwarns`='%d',", fwarns);
strcat(updatequery, string);
format(string, sizeof(string), " `user_wantedlevel`='%d',", wantedlevel);
strcat(updatequery, string);
format(string, sizeof(string), " `user_newbie`='%d'", newbie);
strcat(updatequery, string);
format(string, sizeof(string), " WHERE `user_name`='%s'", sender);
strcat(updatequery, string);
mysql_query(query);
}