[15:50: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 '' at line 1 | Query: UPDATE players SET Health = '100.000000', Armour = '0.000000', PosX = '197.493392', PosY = '-11.265433', PosZ = '1.578125', PosR = '299.467193', Interior = 0, Skin = 299, AdminLevel = 6, AName = 'Zalman', Money = 2147479647, BankMoney = 15000, VIP = 0, VIPExpires = 0, NMute = 0, VMute = 0, CellPhone = -1, Rags = 0, Rope = 0, Age = 22, Gender = 1, HasSeenTutorial = 1, Job = 0, ToySlot1 = 18968, ToySlot2 = 0, ToySlot3 = 0, ToySlot1Bone = 2, ToySlot2Bone = 0, ToySlot3Bone = 0, Toy1RotationPosX = '84.600028',
If you did "Health = '%f'" then it needs to be "Health = %f" along with the others you add a : '' to, you should only use '' on strings(names, passwords, etc)
|
stock savePlayer(playerid) {
new szQuery[512];
GetPlayerPos(playerid, Player[playerid][pPos][0], Player[playerid][pPos][1], Player[playerid][pPos][2]);
GetPlayerFacingAngle(playerid, Player[playerid][pPos][3]);
Player[playerid][pInterior] = GetPlayerInterior(playerid);
Player[playerid][pVirtualWorld] = GetPlayerVirtualWorld(playerid);
GetPlayerHealth(playerid, Player[playerid][pHealth]);
GetPlayerArmour(playerid, Player[playerid][pArmour]);
format(szQuery, sizeof(szQuery), "UPDATE players SET Health = '%f', Armour = '%f', PosX = '%f', PosY = '%f', PosZ = '%f', PosR = '%f'", Player[playerid][pHealth], Player[playerid][pArmour], Player[playerid][pPos][0], Player[playerid][pPos][1], Player[playerid][pPos][2], Player[playerid][pPos][3]);
format(szQuery, sizeof(szQuery), "%s, Interior = %d, Skin = %d, AdminLevel = %d, AName = '%s', Money = %d, BankMoney = %d, VIP = %d, VIPExpires = %d, NMute = %d, VMute = %d, CellPhone = %d, Rags = %d, Rope = %d, Age = %d, Gender = %d, HasSeenTutorial = %d, Job = %d", szQuery,
Player[playerid][pInterior], Player[playerid][pSkin], Player[playerid][AdminLevel], Player[playerid][AName], Player[playerid][Money], Player[playerid][BankMoney], Player[playerid][VIP], Player[playerid][VIPExpires],
Player[playerid][NMute], Player[playerid][VMute], Player[playerid][CellPhone], Player[playerid][Rags], Player[playerid][Rope], Player[playerid][pAge], Player[playerid][Gender], Player[playerid][HasSeenTutorial], Player[playerid][pJob]);
format(szQuery, sizeof(szQuery), "%s, ToySlot1 = %d, ToySlot2 = %d, ToySlot3 = %d, ToySlot1Bone = %d, ToySlot2Bone = %d, ToySlot3Bone = %d, Toy1RotationPosX = '%f', Toy1RotationPosY = '%f', Toy1RotationPosZ = '%f', Toy2RotationPosX = '%f', Toy2RotationPosY = '%f', Toy2RotationPosZ = '%f', Toy3RotationPosX = '%f', Toy3RotationPosY = '%f', Toy3RotationPosZ = '%f'", szQuery,
Player[playerid][ToySlot][0], Player[playerid][ToySlot][1], Player[playerid][ToySlot][2], Player[playerid][ToySlotBone][0], Player[playerid][ToySlotBone][1], Player[playerid][ToySlotBone][2], Player[playerid][ToyRotationPos][0], Player[playerid][ToyRotationPos][1], Player[playerid][ToyRotationPos][2], Player[playerid][ToyRotationPos][3], Player[playerid][ToyRotationPos][4],
Player[playerid][ToyRotationPos][5], Player[playerid][ToyRotationPos][6], Player[playerid][ToyRotationPos][7], Player[playerid][ToyRotationPos][8]);
format(szQuery, sizeof(szQuery), "%s, ToySlot1PosX = %d, ToySlot1PosY = '%f', ToySlot1PosZ = '%f', ToySlot2PosX = '%f', ToySlot2PosY = '%f', ToySlot2PosZ = '%f', ToySlot3PosX = '%f', ToySlot3PosY = '%f', ToySlot3PosZ = '%f', Toy1ScalePosX = '%f', Toy1ScalePosY = '%f', Toy1ScalePosZ = '%f', Toy2ScalePosX = '%f', Toy2ScalePosY = '%f', Toy2ScalePosZ = '%f', Toy3ScalePosX = '%f', Toy3ScalePosY = '%f', Toy3ScalePosZ = '%f' WHERE ID = %d", szQuery,
Player[playerid][ToySlotPos][0], Player[playerid][ToySlotPos][1], Player[playerid][ToySlotPos][2], Player[playerid][ToySlotPos][3], Player[playerid][ToySlotPos][4], Player[playerid][ToySlotPos][5], Player[playerid][ToySlotPos][6], Player[playerid][ToySlotPos][7], Player[playerid][ToySlotPos][8], Player[playerid][ToyScalePos][0], Player[playerid][ToyScalePos][1], Player[playerid][ToyScalePos][2],
Player[playerid][ToyScalePos][3], Player[playerid][ToyScalePos][4], Player[playerid][ToyScalePos][5], Player[playerid][ToyScalePos][6], Player[playerid][ToyScalePos][7], Player[playerid][ToyScalePos][8], Player[playerid][pDBID]);
mysql_query(szQuery, THREAD_NO_RESULT, playerid, iConnectionHandle);
return 1;
}
Where you have '%d' and '%f' it should be: %d and %f
You don't need apostrophe's on anything but strings (%s). |
stock SaveSomething()
{
new Query[130];
format(Query, sizeof(Query), "UPDATE `Table` SET `Column1`='%s', `Column2`=%d, `Column3`=%f WHERE Name='%s'", PlayerName, Integer, Float, PlayerName);
mysql_query(Query);
return 1;
}