MySQL Error
#1

I am having some sort of weird error with mysql saving with R38.

It won't save the stuff, some of it might be saving. I don't know.

If you can see what's wrong, please tell me! Thank you for reading/responding.

pawn Код:
stock SavePlayerData(playerid)
{
    if(Authenticated[playerid] == 1)
    {
        new
            query[2000],
            Float: pHealth,
            Float: pArmour;//don't forget to change the "2" to "5" when enabling the last pos

        GetPlayerHealth(playerid, pHealth);
        GetPlayerArmour(playerid, pArmour);

        format(query, sizeof(query), "UPDATE `accounts` SET `Adminlevel` = %d, `Money` = %d, `Level` = %d, `LastOn` = %d, `Health` = %f, `Armour` = %f, `Skin` = %d, `Gender` = %d, `LastIP` = '%s', `Age` = %d, `Country` = '%s', `Test` = %d, `Faction` = %d, `FactionRank` = %d, `FactionRankName` = '%s' WHERE `UserID` = %d",
        Player[playerid][Adminlevel],
        real_GetPlayerCash(playerid),
        Player[playerid][Level],
        Player[playerid][LastOn],
        pHealth,
        pArmour,
        Player[playerid][Skin],
        Player[playerid][Gender],
        PlayerIP[playerid],
        Player[playerid][Age],
        Player[playerid][Country],
        Player[playerid][Test],
        Player[playerid][Faction],
        Player[playerid][FactionRank],
        Player[playerid][FactionRankName],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");

        format(query, sizeof(query), "UPDATE `accounts` SET `PrisonSelect` = %d, `PrisonTime` = %d, `AdminPrisonCount` = %d, `SecondsLoggedIn` = %d, `PlayingHours` = %d, `AdminCode` = %d, `PhoneN` = %d, `PhoneCredit` = %d, `PhoneBook` = %d, `House` = %d, `Hotel` = %d, `Hospitalized` = %d WHERE `UserID` = '%d'",
        Player[playerid][PrisonSelect],
        Player[playerid][PrisonTime],
        Player[playerid][AdminPrisonCount],
        Player[playerid][SecondsLoggedIn],
        Player[playerid][PlayingHours],
        Player[playerid][AdminCode],
        Player[playerid][PhoneN],
        Player[playerid][PhoneCredit],
        Player[playerid][PhoneBook],
        Player[playerid][House],
        Player[playerid][Hotel],
        Player[playerid][Hospitalized],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `OnDuty` = %d, `DutyClothes` = %d, `LastSkin` = %d, `LastX` = %f, `LastY` = %f, `LastZ` = %f, `LastA` = %f, `LastInt` = %d, `LastWorld` = %d, `InFactionHQ` = %d, `InHouse` = %d WHERE `UserID` = '%d'",
        Player[playerid][OnDuty],
        Player[playerid][DutyClothes],
        Player[playerid][LastSkin],
        Player[playerid][LastX],
        Player[playerid][LastY],
        Player[playerid][LastZ],
        Player[playerid][LastA],
        Player[playerid][LastInt],
        Player[playerid][LastWorld],
        Player[playerid][InFactionHQ],
        Player[playerid][InHouse],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `Helper` = %d, `Moderator` = %d, `BankPincode` = '%s', `BankNumber` = %d, `BankMoney` = %d, `ExperiencePoints` = %d, `ExperiencePointsNeeded` = %d, `Coins` = %d, `WalkieTalkie` = %d, `WalkieFrequency` = %d WHERE `UserID` = '%d'",
        Player[playerid][Helper],
        Player[playerid][Moderator],
        Player[playerid][BankPincode],
        Player[playerid][BankNumber],
        Player[playerid][BankMoney],
        Player[playerid][ExperiencePoints],
        Player[playerid][ExperiencePointsNeeded],
        Player[playerid][Coins],
        Player[playerid][WalkieTalkie],
        Player[playerid][WalkieFrequency],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `WeaponSlot0` = %d, `WeaponSlot1` = %d, `WeaponSlot2` = %d, `WeaponSlot3` = %d, `WeaponSlot4` = %d, `WeaponSlot5` = %d, `WeaponSlot6` = %d, `WeaponSlot7` = %d, `WeaponSlot8` = %d, `WeaponSlot9` = %d, `WeaponSlot10` = %d, `WeaponSlot11` = %d WHERE `UserID` = '%d'",
        Player[playerid][WeaponSlot0],
        Player[playerid][WeaponSlot1],
        Player[playerid][WeaponSlot2],
        Player[playerid][WeaponSlot3],
        Player[playerid][WeaponSlot4],
        Player[playerid][WeaponSlot5],
        Player[playerid][WeaponSlot6],
        Player[playerid][WeaponSlot7],
        Player[playerid][WeaponSlot8],
        Player[playerid][WeaponSlot9],
        Player[playerid][WeaponSlot10],
        Player[playerid][WeaponSlot11],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `WeaponSlot0Ammo` = %d, `WeaponSlot1Ammo` = %d, `WeaponSlot2Ammo` = %d, `WeaponSlot3Ammo` = %d, `WeaponSlot4Ammo` = %d, `WeaponSlot5Ammo` = %d, `WeaponSlot6Ammo` = %d, `WeaponSlot7Ammo` = %d, `WeaponSlot8Ammo` = %d, `WeaponSlot9Ammo` = %d, `WeaponSlot10Ammo` = %d, `WeaponSlot11Ammo` = %d WHERE `UserID` = '%d'",
        Player[playerid][WeaponSlot0Ammo],
        Player[playerid][WeaponSlot1Ammo],
        Player[playerid][WeaponSlot2Ammo],
        Player[playerid][WeaponSlot3Ammo],
        Player[playerid][WeaponSlot4Ammo],
        Player[playerid][WeaponSlot5Ammo],
        Player[playerid][WeaponSlot6Ammo],
        Player[playerid][WeaponSlot7Ammo],
        Player[playerid][WeaponSlot8Ammo],
        Player[playerid][WeaponSlot9Ammo],
        Player[playerid][WeaponSlot10Ammo],
        Player[playerid][WeaponSlot11Ammo],
        Player[playerid][UserID]);
           
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `Accounts` SET `DutyWeaponSlot0` = %d, `DutyWeaponSlot1` = %d, `DutyWeaponSlot2` = %d, `DutyWeaponSlot3` = %d, `DutyWeaponSlot4` = %d, `DutyWeaponSlot5` = %d, `DutyWeaponSlot6` = %d, `DutyWeaponSlot7` = %d, `DutyWeaponSlot8` = %d, `DutyWeaponSlot9` = %d, `DutyWeaponSlot10` = %d, `DutyWeaponSlot11` = %d WHERE `UserID` = '%d'",
        Player[playerid][DutyWeaponSlot0],
        Player[playerid][DutyWeaponSlot1],
        Player[playerid][DutyWeaponSlot2],
        Player[playerid][DutyWeaponSlot3],
        Player[playerid][DutyWeaponSlot4],
        Player[playerid][DutyWeaponSlot5],
        Player[playerid][DutyWeaponSlot6],
        Player[playerid][DutyWeaponSlot7],
        Player[playerid][DutyWeaponSlot8],
        Player[playerid][DutyWeaponSlot9],
        Player[playerid][DutyWeaponSlot10],
        Player[playerid][DutyWeaponSlot11],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           

        format(query, sizeof(query), "UPDATE `accounts` SET `DutyWeaponSlot0Ammo` = %d, `DutyWeaponSlot1Ammo` = %d, `DutyWeaponSlot2Ammo` = %d, `DutyWeaponSlot3Ammo` = %d, `DutyWeaponSlot4Ammo` = %d, `DutyWeaponSlot5Ammo` = %d, `DutyWeaponSlot6Ammo` = %d, `DutyWeaponSlot7Ammo` = %d, `DutyWeaponSlot8Ammo` = %d, `DutyWeaponSlot9Ammo` = %d, `DutyWeaponSlot10Ammo` = %d, `DutyWeaponSlot11Ammo` = %d WHERE `UserID` = '%d'",
        Player[playerid][DutyWeaponSlot0Ammo],
        Player[playerid][DutyWeaponSlot1Ammo],
        Player[playerid][DutyWeaponSlot2Ammo],
        Player[playerid][DutyWeaponSlot3Ammo],
        Player[playerid][DutyWeaponSlot4Ammo],
        Player[playerid][DutyWeaponSlot5Ammo],
        Player[playerid][DutyWeaponSlot6Ammo],
        Player[playerid][DutyWeaponSlot7Ammo],
        Player[playerid][DutyWeaponSlot8Ammo],
        Player[playerid][DutyWeaponSlot9Ammo],
        Player[playerid][DutyWeaponSlot10Ammo],
        Player[playerid][DutyWeaponSlot11Ammo]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `AntiCheatExemption` = %d, `Bans` = %d, `Kicks` = %d, `LastOnDate` = '%s', `Banned` = %d, `Email` = '%s', `Warns` = %d, `Badge` = %d, `Offline` = %d WHERE `UserID` = '%s'",
        Player[playerid][AntiCheatExemption],
        Player[playerid][Bans],
        Player[playerid][Kicks],
        date(gettime()+7200, 1),
        Player[playerid][Banned],
        Player[playerid][Email],
        Player[playerid][Warns],
        Player[playerid][Badge],
        Player[playerid][Offline],
        Player[playerid][UserID]);

        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
    }
    return 1;
}
Reply
#2

Did you tried Debug messages ?

pawn Код:
if(Authenticated[playerid] ==0)
    {
        SendClientMessage(playerid, -1, "You are not identified");
        return 0;
    }
    else if(Authenticated[playerid] == 1)
    {
        new
            query[2000],
            Float: pHealth,
            Float: pArmour;//don't forget to change the "2" to "5" when enabling the last pos

        GetPlayerHealth(playerid, pHealth);
        GetPlayerArmour(playerid, pArmour);

        format(query, sizeof(query), "UPDATE `accounts` SET `Adminlevel` = %d, `Money` = %d, `Level` = %d, `LastOn` = %d, `Health` = %f, `Armour` = %f, `Skin` = %d, `Gender` = %d, `LastIP` = '%s', `Age` = %d, `Country` = '%s', `Test` = %d, `Faction` = %d, `FactionRank` = %d, `FactionRankName` = '%s' WHERE `UserID` = %d",
        Player[playerid][Adminlevel],
        real_GetPlayerCash(playerid),
        Player[playerid][Level],
        Player[playerid][LastOn],
        pHealth,
        pArmour,
        Player[playerid][Skin],
        Player[playerid][Gender],
        PlayerIP[playerid],
        Player[playerid][Age],
        Player[playerid][Country],
        Player[playerid][Test],
        Player[playerid][Faction],
        Player[playerid][FactionRank],
        Player[playerid][FactionRankName],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");

        format(query, sizeof(query), "UPDATE `accounts` SET `PrisonSelect` = %d, `PrisonTime` = %d, `AdminPrisonCount` = %d, `SecondsLoggedIn` = %d, `PlayingHours` = %d, `AdminCode` = %d, `PhoneN` = %d, `PhoneCredit` = %d, `PhoneBook` = %d, `House` = %d, `Hotel` = %d, `Hospitalized` = %d WHERE `UserID` = '%d'",
        Player[playerid][PrisonSelect],
        Player[playerid][PrisonTime],
        Player[playerid][AdminPrisonCount],
        Player[playerid][SecondsLoggedIn],
        Player[playerid][PlayingHours],
        Player[playerid][AdminCode],
        Player[playerid][PhoneN],
        Player[playerid][PhoneCredit],
        Player[playerid][PhoneBook],
        Player[playerid][House],
        Player[playerid][Hotel],
        Player[playerid][Hospitalized],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `OnDuty` = %d, `DutyClothes` = %d, `LastSkin` = %d, `LastX` = %f, `LastY` = %f, `LastZ` = %f, `LastA` = %f, `LastInt` = %d, `LastWorld` = %d, `InFactionHQ` = %d, `InHouse` = %d WHERE `UserID` = '%d'",
        Player[playerid][OnDuty],
        Player[playerid][DutyClothes],
        Player[playerid][LastSkin],
        Player[playerid][LastX],
        Player[playerid][LastY],
        Player[playerid][LastZ],
        Player[playerid][LastA],
        Player[playerid][LastInt],
        Player[playerid][LastWorld],
        Player[playerid][InFactionHQ],
        Player[playerid][InHouse],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `Helper` = %d, `Moderator` = %d, `BankPincode` = '%s', `BankNumber` = %d, `BankMoney` = %d, `ExperiencePoints` = %d, `ExperiencePointsNeeded` = %d, `Coins` = %d, `WalkieTalkie` = %d, `WalkieFrequency` = %d WHERE `UserID` = '%d'",
        Player[playerid][Helper],
        Player[playerid][Moderator],
        Player[playerid][BankPincode],
        Player[playerid][BankNumber],
        Player[playerid][BankMoney],
        Player[playerid][ExperiencePoints],
        Player[playerid][ExperiencePointsNeeded],
        Player[playerid][Coins],
        Player[playerid][WalkieTalkie],
        Player[playerid][WalkieFrequency],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `WeaponSlot0` = %d, `WeaponSlot1` = %d, `WeaponSlot2` = %d, `WeaponSlot3` = %d, `WeaponSlot4` = %d, `WeaponSlot5` = %d, `WeaponSlot6` = %d, `WeaponSlot7` = %d, `WeaponSlot8` = %d, `WeaponSlot9` = %d, `WeaponSlot10` = %d, `WeaponSlot11` = %d WHERE `UserID` = '%d'",
        Player[playerid][WeaponSlot0],
        Player[playerid][WeaponSlot1],
        Player[playerid][WeaponSlot2],
        Player[playerid][WeaponSlot3],
        Player[playerid][WeaponSlot4],
        Player[playerid][WeaponSlot5],
        Player[playerid][WeaponSlot6],
        Player[playerid][WeaponSlot7],
        Player[playerid][WeaponSlot8],
        Player[playerid][WeaponSlot9],
        Player[playerid][WeaponSlot10],
        Player[playerid][WeaponSlot11],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `WeaponSlot0Ammo` = %d, `WeaponSlot1Ammo` = %d, `WeaponSlot2Ammo` = %d, `WeaponSlot3Ammo` = %d, `WeaponSlot4Ammo` = %d, `WeaponSlot5Ammo` = %d, `WeaponSlot6Ammo` = %d, `WeaponSlot7Ammo` = %d, `WeaponSlot8Ammo` = %d, `WeaponSlot9Ammo` = %d, `WeaponSlot10Ammo` = %d, `WeaponSlot11Ammo` = %d WHERE `UserID` = '%d'",
        Player[playerid][WeaponSlot0Ammo],
        Player[playerid][WeaponSlot1Ammo],
        Player[playerid][WeaponSlot2Ammo],
        Player[playerid][WeaponSlot3Ammo],
        Player[playerid][WeaponSlot4Ammo],
        Player[playerid][WeaponSlot5Ammo],
        Player[playerid][WeaponSlot6Ammo],
        Player[playerid][WeaponSlot7Ammo],
        Player[playerid][WeaponSlot8Ammo],
        Player[playerid][WeaponSlot9Ammo],
        Player[playerid][WeaponSlot10Ammo],
        Player[playerid][WeaponSlot11Ammo],
        Player[playerid][UserID]);
           
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `Accounts` SET `DutyWeaponSlot0` = %d, `DutyWeaponSlot1` = %d, `DutyWeaponSlot2` = %d, `DutyWeaponSlot3` = %d, `DutyWeaponSlot4` = %d, `DutyWeaponSlot5` = %d, `DutyWeaponSlot6` = %d, `DutyWeaponSlot7` = %d, `DutyWeaponSlot8` = %d, `DutyWeaponSlot9` = %d, `DutyWeaponSlot10` = %d, `DutyWeaponSlot11` = %d WHERE `UserID` = '%d'",
        Player[playerid][DutyWeaponSlot0],
        Player[playerid][DutyWeaponSlot1],
        Player[playerid][DutyWeaponSlot2],
        Player[playerid][DutyWeaponSlot3],
        Player[playerid][DutyWeaponSlot4],
        Player[playerid][DutyWeaponSlot5],
        Player[playerid][DutyWeaponSlot6],
        Player[playerid][DutyWeaponSlot7],
        Player[playerid][DutyWeaponSlot8],
        Player[playerid][DutyWeaponSlot9],
        Player[playerid][DutyWeaponSlot10],
        Player[playerid][DutyWeaponSlot11],
        Player[playerid][UserID]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           

        format(query, sizeof(query), "UPDATE `accounts` SET `DutyWeaponSlot0Ammo` = %d, `DutyWeaponSlot1Ammo` = %d, `DutyWeaponSlot2Ammo` = %d, `DutyWeaponSlot3Ammo` = %d, `DutyWeaponSlot4Ammo` = %d, `DutyWeaponSlot5Ammo` = %d, `DutyWeaponSlot6Ammo` = %d, `DutyWeaponSlot7Ammo` = %d, `DutyWeaponSlot8Ammo` = %d, `DutyWeaponSlot9Ammo` = %d, `DutyWeaponSlot10Ammo` = %d, `DutyWeaponSlot11Ammo` = %d WHERE `UserID` = '%d'",
        Player[playerid][DutyWeaponSlot0Ammo],
        Player[playerid][DutyWeaponSlot1Ammo],
        Player[playerid][DutyWeaponSlot2Ammo],
        Player[playerid][DutyWeaponSlot3Ammo],
        Player[playerid][DutyWeaponSlot4Ammo],
        Player[playerid][DutyWeaponSlot5Ammo],
        Player[playerid][DutyWeaponSlot6Ammo],
        Player[playerid][DutyWeaponSlot7Ammo],
        Player[playerid][DutyWeaponSlot8Ammo],
        Player[playerid][DutyWeaponSlot9Ammo],
        Player[playerid][DutyWeaponSlot10Ammo],
        Player[playerid][DutyWeaponSlot11Ammo]);
        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
           
        format(query, sizeof(query), "UPDATE `accounts` SET `AntiCheatExemption` = %d, `Bans` = %d, `Kicks` = %d, `LastOnDate` = '%s', `Banned` = %d, `Email` = '%s', `Warns` = %d, `Badge` = %d, `Offline` = %d WHERE `UserID` = '%s'",
        Player[playerid][AntiCheatExemption],
        Player[playerid][Bans],
        Player[playerid][Kicks],
        date(gettime()+7200, 1),
        Player[playerid][Banned],
        Player[playerid][Email],
        Player[playerid][Warns],
        Player[playerid][Badge],
        Player[playerid][Offline],
        Player[playerid][UserID]);

        mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
    }
Also, SavePlayerData is called when a player disconnect ?
in OnPlayerDisconnect ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)