24.06.2012, 21:02
After I split it into several queries, I get some errors:
This is the code now:
Quote:
[01:02:30] Error #1064 - Error: 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 '0.000000', WZ = '0.000000', WVW = '0', WInt = '0', WValue = '0', WSeeds = '0', W' at line 1 | Query: UPDATE players SET WExists = '0', WX = '0.000000, WY = '0.000000', WZ = '0.000000', WVW = '0', WInt = '0', WValue = '0', WSeeds = '0', WObject = '0', WTimer = '0', CarLic = '0', FlyLic = '0', BoatLic = '0', WeaponLic = '0', Tutorial = '0', TutorialStep = '0', TutorialStepDelay = '0', FightStyle = '0', Insurance = '0', Hospital = '1', NMute = '0', NMuteTotal = '0', ADMute = '0', ADMuteTotal = '0', Flag = '', IP = '90.222.221.85', Status = 1 WHERE ID = 0 [01:02:30] Error #1064 - Error: 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 'Lock = '0', LockCar = '0', GasCan = '0', Firstaid = '0', Sprunk = '0', Cigar = '' at line 1 | Query: UPDATE players SET CHits = '0', FHits = '0', AcceptReport = '0', TrashReport = '0', Spraycan = '0', Boombox = '0', BoomboxOwned = '0', BankPIN = '0', BankPINReset = '0', Lock = '0', LockCar = '0', GasCan = '0', Firstaid = '0', Sprunk = '0', Cigar = '0', Crack = '0', Pot = '0', DrugsTime = '0', LawyerTime = '0' WHERE ID = 0 [01:02:30] (MySQL) Query: UPDATE players SET Speedo = '0', Phousekey = '0', Phousekey2 = '0', Renting = '0', RefPoints = '0', RefPlayer = '', HSpawn = '0', HSpawnX = '0.000000', HSpawnY = '0.000000', HSpawnZ = '0.000000', HSpawnInt = '0', HSpawnVW = '0', Biz = '0', VBiz = '0', RequestingBackup = '0', AttendingBackupCall = '0', Bugged = '0', HeadValue = '0', ContractBy = '', ContractDetail = '', C4Used = '0', C4 = '0', Bombs = '0' WHERE ID = 0 | ResultID: 4 [01:02:30] (MySQL) Query: UPDATE players SET KillLog6 = '', KillLog7 = '', KillLog8 = '', KillLog9 = '', Deaths = '0', Faction = '0', GangID = '0', GangRank = '0', BeingInvitedToGang = '0', Rank = '0', Division = '0', Leader = '0', Married = '0', MarriedTo = '', Duty = '0', JobDuty = '0', Crimes = '0', WantedLevel = '0', Radio = '0', RadioFreq = '0', Wristwatch = '0', Blindfold = '0', Rope = '0', Dashboard = '0' WHERE ID = 0 | ResultID: 4 [01:02:30] Error #1064 - Error: 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 'INT = '0', VW = '0', Dice = '0', Weapon0 = '0', Weapona0 = '0', Weapon1 = '0', W' at line 1 | Query: UPDATE players SET ToggedVIPChat = '0', Warns = '0', GangWarn = '0', Pos_x = '1999.530761', Pos_y = '-1449.328125', Pos_z = '10.559399', Pos_a = '0.000000', Health = '4.000000', Armor = '0.000000', SHealth = '0.000000', SArmor = '0.000000', Materials = '0', Cocaine = '0', Fishes = '0', BiggestFish = '0', Crates = '0', INT = '0', VW = '0', Dice = '0', Weapon0 = '0', Weapona0 = '0', Weapon1 = '0', Weapona1 = '0', Weapon2 = '0', Weapona2 = '0', Weapon3 = '0', Weapona3 = '0', Weapon4 = '0', Weapona4 = '0', Weapon5 = '0', Weapona5 = '0', Weapon6 = '0', Weapona6 = '0', Weapon7 = '0', Weapona7 = '0', Weapon8 = '0', Weapona8 = '0', Weapon9 = '0', Weapona9 = '0', Weapon10 = '0', Weapona10 = '0', KillLog0 = '', KillLog1 = '', KillLog2 = '', KillLog3 = '', KillLog4 = '', KillLog5 = '' WHERE ID = 0 [01:02:30] (MySQL) Query: UPDATE players SET Spectate = '0', Banned = '0', PermaBanned = '0', LiveBanned = '0', Muted = '0', ReportMuted = '0', Exp = '0', VIP = '0', VMuted = '0', Jailed = '0', JailTime = '0', BeingSentenced = '0', ProbationTime = '0', PrisonReason = '', PrisonedBy = '', BannedReason = '', BannedBy = '' WHERE ID = 0 | ResultID: 4 [01:02:30] (MySQL) Query: UPDATE players SET JobID = '0', JobID2 = '0', MechTime = '0', DetSkill = '0', DrugsSkill = '0', SmugSkill = '0', ArmsSkill = '0', LawSkill = '0', TruckSkill = '0', MechSkill = '0', FishSkill = '0', TraderPerk = '0', Skin = '0', Team = '0', Accent = '0', Admin = '0', Helper = '0', DutyHours = '0', AcceptedHelp = '0' WHERE ID = 0 | ResultID: 4 [01:02:30] (MySQL) Query: UPDATE players SET Cash = '0', Deposit = '0', CreditCard = '0', PayDay = '0', PayCheck = '0', ConnectTime = '0', WRestricted = '0', Age = '0', Sex = '0', Level = '0', HasCellphone = '0', Internet = '0', Song1 = '0', Song2 = '0', Number = '0', SpeakerPhone = '0', PB = '0' , PhonePrivacy = '0' WHERE ID = 0 | ResultID: 4 |
pawn Код:
stock savePlayer(playerid)
{
// Let's save the player's information into the mysql database so when they login it can be reset.
// Before we do anything, we need to grab the most up-to-date information and save it into the player variables.
new
szQuery[1024]; // Since we're going to save a lot of data, our query size will need to be big.
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
PlayerInfo[playerid][pINT] = GetPlayerInterior(playerid);
PlayerInfo[playerid][pVW] = GetPlayerVirtualWorld(playerid);
PlayerInfo[playerid][pWantedLevel] = GetPlayerWantedLevel(playerid);
new
Float:x,
Float:y,
Float:z
;
GetPlayerHealth(playerid,PlayerInfo[playerid][pHealth]);
GetPlayerArmour(playerid,PlayerInfo[playerid][pArmor]);
GetPlayerPos(playerid,x,y,z);
PlayerInfo[playerid][pPos_x] = x;
PlayerInfo[playerid][pPos_y] = y;
PlayerInfo[playerid][pPos_z] = z;
GetPlayerPos(playerid,PlayerInfo[playerid][pPos_x],PlayerInfo[playerid][pPos_y],PlayerInfo[playerid][pPos_z]);
// We will now take the nformation we grabbed and input it to make a query.
// Remember the database ID? This is one instance of where it will be useful to use.
format(szQuery, sizeof(szQuery), "UPDATE players SET Cash = '%d', Deposit = '%d', CreditCard = '%d', PayDay = '%d', PayCheck = '%d', ConnectTime = '%d'", PlayerInfo[playerid][pCash], PlayerInfo[playerid][pDeposit], PlayerInfo[playerid][pCreditCard], PlayerInfo[playerid][pPayDay], PlayerInfo[playerid][pPayCheck], PlayerInfo[playerid][pConnectTime]);
format(szQuery, sizeof(szQuery), "%s, WRestricted = '%d', Age = '%d', Sex = '%d', Level = '%d', HasCellphone = '%d', Internet = '%d'", szQuery, PlayerInfo[playerid][pWRestricted], PlayerInfo[playerid][pAge], PlayerInfo[playerid][pSex], PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pHasCellphone], PlayerInfo[playerid][pInternet]);
format(szQuery, sizeof(szQuery), "%s, Song1 = '%d', Song2 = '%d', Number = '%d', SpeakerPhone = '%d', PB = '%d' , PhonePrivacy = '%d' WHERE ID = %d", szQuery, PlayerInfo[playerid][pSong][1], PlayerInfo[playerid][pSong][2], PlayerInfo[playerid][pNumber], PlayerInfo[playerid][pSpeakerPhone], PlayerInfo[playerid][pPB], PlayerInfo[playerid][pPhonePrivacy], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
format(szQuery, sizeof(szQuery), "UPDATE players SET JobID = '%d', JobID2 = '%d', MechTime = '%d', DetSkill = '%d', DrugsSkill = '%d', SmugSkill = '%d'", PlayerInfo[playerid][pJobID], PlayerInfo[playerid][pJobID2], PlayerInfo[playerid][pMechTime], PlayerInfo[playerid][pDetSkill], PlayerInfo[playerid][pDrugsSkill], PlayerInfo[playerid][pSmugSkill]);
format(szQuery, sizeof(szQuery), "%s, ArmsSkill = '%d', LawSkill = '%d', TruckSkill = '%d', MechSkill = '%d', FishSkill = '%d', TraderPerk = '%d'", szQuery, PlayerInfo[playerid][pArmsSkill], PlayerInfo[playerid][pLawSkill], PlayerInfo[playerid][pTruckSkill], PlayerInfo[playerid][pMechSkill], PlayerInfo[playerid][pFishSkill], PlayerInfo[playerid][pTraderPerk]);
format(szQuery, sizeof(szQuery), "%s, Skin = '%d', Team = '%d', Accent = '%d', Admin = '%d', Helper = '%d', DutyHours = '%d', AcceptedHelp = '%d' WHERE ID = %d", szQuery, PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pTeam], PlayerInfo[playerid][pAccent], PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pHelper], PlayerInfo[playerid][pDutyHours], PlayerInfo[playerid][pAcceptedHelp], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
format(szQuery, sizeof(szQuery), "UPDATE players SET Spectate = '%d', Banned = '%d', PermaBanned = '%d', LiveBanned = '%d', Muted = '%d', ReportMuted = '%d'", PlayerInfo[playerid][pSpectate], PlayerInfo[playerid][pBanned], PlayerInfo[playerid][pPermaBanned], PlayerInfo[playerid][pLiveBanned], PlayerInfo[playerid][pMuted], PlayerInfo[playerid][pReportMuted]);
format(szQuery, sizeof(szQuery), "%s, Exp = '%d', VIP = '%d', VMuted = '%d', Jailed = '%d', JailTime = '%d', BeingSentenced = '%d'", szQuery, PlayerInfo[playerid][pExp], PlayerInfo[playerid][pVIP], PlayerInfo[playerid][pVMuted], PlayerInfo[playerid][pJailed], PlayerInfo[playerid][pJailTime], PlayerInfo[playerid][pBeingSentenced]);
format(szQuery, sizeof(szQuery), "%s, ProbationTime = '%d', PrisonReason = '%s', PrisonedBy = '%s', BannedReason = '%s', BannedBy = '%s' WHERE ID = %d", szQuery, PlayerInfo[playerid][pProbationTime], PlayerInfo[playerid][pPrisonReason], PlayerInfo[playerid][pPrisonedBy], PlayerInfo[playerid][pBannedReason], PlayerInfo[playerid][pBannedBy], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
format(szQuery, sizeof(szQuery), "UPDATE players SET ToggedVIPChat = '%d', Warns = '%d', GangWarn = '%d', Pos_x = '%f', Pos_y = '%f', Pos_z = '%f'", PlayerInfo[playerid][pToggedVIPChat], PlayerInfo[playerid][pWarns], PlayerInfo[playerid][pGangWarn], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);
format(szQuery, sizeof(szQuery), "%s, Pos_a = '%f', Health = '%f', Armor = '%f', SHealth = '%f', SArmor = '%f', Materials = '%d'", szQuery, PlayerInfo[playerid][pPos_a], PlayerInfo[playerid][pHealth], PlayerInfo[playerid][pArmor], PlayerInfo[playerid][pSHealth], PlayerInfo[playerid][pSArmor], PlayerInfo[playerid][pMaterials]);
format(szQuery, sizeof(szQuery), "%s, Cocaine = '%d', Fishes = '%d', BiggestFish = '%d', Crates = '%d', INT = '%d', VW = '%d', Dice = '%d'", szQuery, PlayerInfo[playerid][pCocaine], PlayerInfo[playerid][pFishes], PlayerInfo[playerid][pBiggestFish], PlayerInfo[playerid][pCrates], PlayerInfo[playerid][pINT], PlayerInfo[playerid][pVW], PlayerInfo[playerid][pDice]);
for(new i = 0; i < 11; i++)
{
format(szQuery, sizeof(szQuery), "%s, Weapon%d = '%d'", szQuery, i, PlayerInfo[playerid][pWeapon][i]);
format(szQuery, sizeof(szQuery), "%s, Weapona%d = '%d'", szQuery, i, PlayerInfo[playerid][pWeapona][i]);
}
format(szQuery, sizeof(szQuery), "%s, KillLog0 = '%s', KillLog1 = '%s', KillLog2 = '%s', KillLog3 = '%s', KillLog4 = '%s', KillLog5 = '%s' WHERE ID = %d", szQuery, PlayerInfo[playerid][pKillLog0], PlayerInfo[playerid][pKillLog1], PlayerInfo[playerid][pKillLog2], PlayerInfo[playerid][pKillLog3], PlayerInfo[playerid][pKillLog4], PlayerInfo[playerid][pKillLog5], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
format(szQuery, sizeof(szQuery), "UPDATE players SET KillLog6 = '%s', KillLog7 = '%s', KillLog8 = '%s', KillLog9 = '%s', Deaths = '%d', Faction = '%d'", PlayerInfo[playerid][pKillLog6], PlayerInfo[playerid][pKillLog7], PlayerInfo[playerid][pKillLog8], PlayerInfo[playerid][pKillLog9], PlayerInfo[playerid][pDeaths], PlayerInfo[playerid][pFaction]);
format(szQuery, sizeof(szQuery), "%s, GangID = '%d', GangRank = '%d', BeingInvitedToGang = '%d', Rank = '%d', Division = '%d', Leader = '%d'", szQuery, PlayerInfo[playerid][pGangID], PlayerInfo[playerid][pGangRank], PlayerInfo[playerid][pBeingInvitedToGang], PlayerInfo[playerid][pRank], PlayerInfo[playerid][pDivision], PlayerInfo[playerid][pLeader]);
format(szQuery, sizeof(szQuery), "%s, Married = '%d', MarriedTo = '%s', Duty = '%d', JobDuty = '%d', Crimes = '%d', WantedLevel = '%d'", szQuery, PlayerInfo[playerid][pMarried], PlayerInfo[playerid][pMarriedTo], PlayerInfo[playerid][pDuty], PlayerInfo[playerid][pJobDuty], PlayerInfo[playerid][pCrimes], PlayerInfo[playerid][pWantedLevel]);
format(szQuery, sizeof(szQuery), "%s, Radio = '%d', RadioFreq = '%d', Wristwatch = '%d', Blindfold = '%d', Rope = '%d', Dashboard = '%d' WHERE ID = %d", szQuery, PlayerInfo[playerid][pRadio], PlayerInfo[playerid][pRadioFreq], PlayerInfo[playerid][pWristwatch], PlayerInfo[playerid][pBlindfold], PlayerInfo[playerid][pRope], PlayerInfo[playerid][pDashboard], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
format(szQuery, sizeof(szQuery), "UPDATE players SET Speedo = '%d', Phousekey = '%d', Phousekey2 = '%d', Renting = '%d', RefPoints = '%d', RefPlayer = '%s'", PlayerInfo[playerid][pSpeedo], PlayerInfo[playerid][pPhousekey], PlayerInfo[playerid][pPhousekey2], PlayerInfo[playerid][pRenting], PlayerInfo[playerid][pRefPoints], PlayerInfo[playerid][pRefPlayer]);
format(szQuery, sizeof(szQuery), "%s, HSpawn = '%d', HSpawnX = '%f', HSpawnY = '%f', HSpawnZ = '%f', HSpawnInt = '%d', HSpawnVW = '%d'", szQuery, PlayerInfo[playerid][pHSpawn], PlayerInfo[playerid][pHSpawnX], PlayerInfo[playerid][pHSpawnY], PlayerInfo[playerid][pHSpawnZ], PlayerInfo[playerid][pHSpawnInt], PlayerInfo[playerid][pHSpawnVW]);
format(szQuery, sizeof(szQuery), "%s, Biz = '%d', VBiz = '%d', RequestingBackup = '%d', AttendingBackupCall = '%d', Bugged = '%d'", szQuery, PlayerInfo[playerid][pBiz], PlayerInfo[playerid][pVBiz], PlayerInfo[playerid][pRequestingBackup], PlayerInfo[playerid][pAttendingBackupCall], PlayerInfo[playerid][pBugged]);
format(szQuery, sizeof(szQuery), "%s, HeadValue = '%d', ContractBy = '%s', ContractDetail = '%s', C4Used = '%d', C4 = '%d', Bombs = '%d' WHERE ID = %d", szQuery, PlayerInfo[playerid][pHeadValue], PlayerInfo[playerid][pContractBy], PlayerInfo[playerid][pContractDetail], PlayerInfo[playerid][pC4Used], PlayerInfo[playerid][pC4], PlayerInfo[playerid][pBombs], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
format(szQuery, sizeof(szQuery), "UPDATE players SET CHits = '%d', FHits = '%d', AcceptReport = '%d', TrashReport = '%d', Spraycan = '%d', Boombox = '%d'", PlayerInfo[playerid][pCHits], PlayerInfo[playerid][pFHits], PlayerInfo[playerid][pAcceptReport], PlayerInfo[playerid][pTrashReport], PlayerInfo[playerid][pSpraycan], PlayerInfo[playerid][pBoombox]);
format(szQuery, sizeof(szQuery), "%s, BoomboxOwned = '%d', BankPIN = '%d', BankPINReset = '%d', Lock = '%d', LockCar = '%d', GasCan = '%d'", szQuery, PlayerInfo[playerid][pBoomboxOwned], PlayerInfo[playerid][pBankPIN], PlayerInfo[playerid][pBankPINReset], PlayerInfo[playerid][pLock], PlayerInfo[playerid][pLockCar], PlayerInfo[playerid][pGasCan]);
format(szQuery, sizeof(szQuery), "%s, Firstaid = '%d', Sprunk = '%d', Cigar = '%d', Crack = '%d', Pot = '%d', DrugsTime = '%d', LawyerTime = '%d' WHERE ID = %d", szQuery, PlayerInfo[playerid][pFirstaid], PlayerInfo[playerid][pSprunk], PlayerInfo[playerid][pCigar], PlayerInfo[playerid][pCrack], PlayerInfo[playerid][pPot], PlayerInfo[playerid][pDrugsTime], PlayerInfo[playerid][pLawyerTime], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
format(szQuery, sizeof(szQuery), "UPDATE players SET WExists = '%d', WX = '%f, WY = '%f', WZ = '%f', WVW = '%d', WInt = '%d', WValue = '%d', WSeeds = '%d'", PlayerInfo[playerid][pWExists], PlayerInfo[playerid][pWX], PlayerInfo[playerid][pWY], PlayerInfo[playerid][pWZ], PlayerInfo[playerid][pWVW], PlayerInfo[playerid][pWInt], PlayerInfo[playerid][pWValue], PlayerInfo[playerid][pWSeeds]);
format(szQuery, sizeof(szQuery), "%s, WObject = '%d', WTimer = '%d', CarLic = '%d', FlyLic = '%d', BoatLic = '%d', WeaponLic = '%d'", szQuery, PlayerInfo[playerid][pWObject], PlayerInfo[playerid][pWTimer], PlayerInfo[playerid][pCarLic], PlayerInfo[playerid][pFlyLic], PlayerInfo[playerid][pBoatLic], PlayerInfo[playerid][pWeaponLic]);
format(szQuery, sizeof(szQuery), "%s, Tutorial = '%d', TutorialStep = '%d', TutorialStepDelay = '%d', FightStyle = '%d', Insurance = '%d', Hospital = '%d'", szQuery, PlayerInfo[playerid][pTutorial], PlayerInfo[playerid][pTutorialStep], PlayerInfo[playerid][pTutorialStepDelay], PlayerInfo[playerid][pFightStyle], PlayerInfo[playerid][pInsurance], PlayerInfo[playerid][pHospital]);
format(szQuery, sizeof(szQuery), "%s, NMute = '%d', NMuteTotal = '%d', ADMute = '%d', ADMuteTotal = '%d', Flag = '%s', IP = '%s'", szQuery, PlayerInfo[playerid][pNMute], PlayerInfo[playerid][pNMuteTotal], PlayerInfo[playerid][pADMute], PlayerInfo[playerid][pADMuteTotal], PlayerInfo[playerid][pFlag], PlayerInfo[playerid][pIP]);
format(szQuery, sizeof(szQuery), "%s, Status = %d WHERE ID = %d", szQuery, PlayerInfo[playerid][pStatus], PlayerInfo[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
return 1;
}