MySQL Saving Help
#1

pawn Код:
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 WHERE ID = %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][pDBID]);
I get a saving error when disconnecting, here is what the logs show:
Код:
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 ' Money = 1500, BankMoney = 15000, VIP = 0, VIPExpires = 0, NMute = 0, VMute = 0,' at line 1 | Query: UPDATE players SET Health = '100.000000', Armour = '0.000000', PosX = '980.449401', PosY = '-1393.637817', PosZ = '12.949835', PosR = '276.879241', Interior = 0, Skin = 147, AdminLevel = 6, AName = , Money = 1500, BankMoney = 15000, VIP = 0, VIPExpires = 0, NMute = 0, VMute = 0, CellPhone = 0, Rags = 0, Rope = 0 WHERE ID = 1
Reply
#2

Код:
UPDATE players SET Health = '100.000000', Armour = '0.000000', PosX = '980.449401', PosY = '-1393.637817', PosZ = '12.949835', PosR = '276.879241', Interior = 0, Skin = 147, AdminLevel = 6, AName = , Money = 1500, BankMoney = 15000, VIP = 0, VIPExpires = 0, NMute = 0, VMute = 0, CellPhone = 0, Rags = 0, Rope = 0 WHERE ID = 1
Specfically
Код:
AName = ,
Reply
#3

You don't need apostrophes/single-quotes on floats, you only need them on strings. > '
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)