Hi guys.
I'm using liberty gm.
Код:
stock SavePlayer(playerid)
{
printf("x");
GetPlayerPos(playerid, CharacterData[playerid][pPosition][0], CharacterData[playerid][pPosition][1], CharacterData[playerid][pPosition][2]);
GetPlayerFacingAngle(playerid, CharacterData[playerid][pPosition][3]);
CharacterData[playerid][pInt] = GetPlayerInterior(playerid);
CharacterData[playerid][pVW] = GetPlayerVirtualWorld(playerid);
printf("Deboeg");
GetPlayerHealth(playerid, CharacterData[playerid][pHealth]);
GetPlayerArmour(playerid, CharacterData[playerid][pArmor]);
printf("Deboeg");
SaveContacts(playerid);
SavePlayerWeapons(playerid);
for(new toyID = 1; toyID < MAX_TOYS; toyID++)
{
if(ToyData[toyID][toy_Owner] == CharacterData[playerid][pSQLID])
{
SaveToy(toyID);
}
else
{
continue;
}
}
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "UPDATE `characters` SET `ip` = '%e', `gender` = '%d', `age` = '%d', `positionx` = '%f', `positiony` = '%f', `positionz` = '%f', `positiona` = '%f'", CharacterData[playerid][pIP], CharacterData[playerid][pGender], CharacterData[playerid][pAge], CharacterData[playerid][pPosition][0], CharacterData[playerid][pPosition][1], CharacterData[playerid][pPosition][2], CharacterData[playerid][pPosition][3]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `adminlevel` = '%d', `cash` = '%d', `virtualworld` = '%d', `interior` = '%d', `registerdate` = '%e', `lastlogin` = '%e', `ammo1` = '%d'", szQuery, CharacterData[playerid][pAdmin], CharacterData[playerid][pCash], GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid), CharacterData[playerid][pRegisterDate], CharacterData[playerid][pLastLogin], CharacterData[playerid][pAmmo][1]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `houseID` = '%d', `factionID` = '%d', `rank` = '%d', `jobID` = '%d', `materials` = '%d', `Cocaine` = '%d', `pot` = '%d', `skin` = '%d'",szQuery, CharacterData[playerid][pHouseID], CharacterData[playerid][pFaction], CharacterData[playerid][pRank], CharacterData[playerid][pJob], CharacterData[playerid][pMaterials], CharacterData[playerid][pCocaine], CharacterData[playerid][pPot], CharacterData[playerid][pSkin]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `phonenumber` = '%d', `phone` = '%d', `level` = '%d', `respects` = '%d', `paycheck` = '%d', `bizID` = '%d'", szQuery, CharacterData[playerid][pPhoneNumber], CharacterData[playerid][pPhone], CharacterData[playerid][pLevel], CharacterData[playerid][pRespects], CharacterData[playerid][pPayCheck], CharacterData[playerid][pBizID]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `boatlicense` = '%d', `bikelicense` = '%d', `carlicense` = '%d', `planelicense` = '%d', `developer` = '%d', `betatester` = '%d', `playinghours` = '%d'", szQuery, CharacterData[playerid][pBoatLicense], CharacterData[playerid][pBikeLicense], CharacterData[playerid][pCarLicense], CharacterData[playerid][pPlaneLicense], CharacterData[playerid][pDev], CharacterData[playerid][pBetaTester], CharacterData[playerid][pPlayingHours]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `weapon0` = '%d', `weapon1` = '%d', `weapon2` = '%d', `weapon3` = '%d', `weapon4` = '%d', `weapon5` = '%d', `weapon6` = '%d'", szQuery, CharacterData[playerid][pWeapon][0], CharacterData[playerid][pWeapon][1], CharacterData[playerid][pWeapon][2], CharacterData[playerid][pWeapon][3], CharacterData[playerid][pWeapon][4], CharacterData[playerid][pWeapon][5], CharacterData[playerid][pWeapon][6]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `weapon7` = '%d', `weapon8` = '%d', `weapon9` = '%d', `weapon10` = '%d', `weapon11` = '%d', `weapon12` = '%d', `ammo0` = '%d', `insidebiz` = '%d', `totalfine` = '%d'",
szQuery, CharacterData[playerid][pWeapon][7], CharacterData[playerid][pWeapon][8], CharacterData[playerid][pWeapon][9], CharacterData[playerid][pWeapon][10], CharacterData[playerid][pWeapon][11], CharacterData[playerid][pWeapon][12], CharacterData[playerid][pAmmo][0], CharacterData[playerid][pInsideBiz], CharacterData[playerid][pTotalFine]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `ammo2` = '%d', `ammo3` = '%d', `ammo4` = '%d', `ammo5` = '%d', `ammo6` = '%d', `ammo7` = '%d', `ammo8` = '%d', `ammo9` = '%d', `insidehouse` = '%d'"
, szQuery, CharacterData[playerid][pAmmo][2], CharacterData[playerid][pAmmo][3], CharacterData[playerid][pAmmo][4], CharacterData[playerid][pAmmo][5], CharacterData[playerid][pAmmo][6], CharacterData[playerid][pAmmo][7], CharacterData[playerid][pAmmo][8], CharacterData[playerid][pAmmo][9], CharacterData[playerid][pInsideHouse]);
// From here
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `ammo10` = '%d', `ammo11` = '%d', `ammo12` = '%d', `health` = '%f', `armor` = '%f', `wanted` = '%i'", szQuery, CharacterData[playerid][pAmmo][10], CharacterData[playerid][pAmmo][11], CharacterData[playerid][pAmmo][12], CharacterData[playerid][pHealth], CharacterData[playerid][pArmor], CharacterData[playerid][pWanted]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `warrant1` = '%e', `warrant2` = '%e', `warrant3` = '%e', `warrant4` = '%e', `warrant5` = '%e', `warrant6` = '%e'", szQuery, CharacterData[playerid][pWarrant1], CharacterData[playerid][pWarrant2], CharacterData[playerid][pWarrant3], CharacterData[playerid][pWarrant4], CharacterData[playerid][pWarrant5], CharacterData[playerid][pWarrant6]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `prisoned` = '%d', `prisontime` = '%d', `banned` = '%i', `banreason` = '%e', `bannedby` = '%e', `bandate` = '%e', `banstamp` = '%d'", szQuery, CharacterData[playerid][pPrisoned], CharacterData[playerid][pPrisonTime], CharacterData[playerid][pBanned], CharacterData[playerid][pBanReason], CharacterData[playerid][pBannedBy], CharacterData[playerid][pBanDate], CharacterData[playerid][pBanStamp]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `hospitalized` = '%d', `autologin` = '%d', `musicstream` = '%d', `helper` = '%d', `stealth` = '%d', `newbietog` = '%d'", szQuery, CharacterData[playerid][pHospitalized], CharacterData[playerid][pAutoLogin], CharacterData[playerid][pMusicStreaming], CharacterData[playerid][pHelper], CharacterData[playerid][pStealth], CharacterData[playerid][pNewbieToggled]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `banappealer` = '%d', `factionmanager` = '%d', `familymanager` = '%d', `housemanager` = '%d', `bannedplayers` = '%d', `kickedplayers` = '%d'", szQuery, CharacterData[playerid][pBanAppealer], CharacterData[playerid][pFactionManager], CharacterData[playerid][pFamilyManager], CharacterData[playerid][pHouseManager], CharacterData[playerid][pBannedPlayers], CharacterData[playerid][pKickedPlayers]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `leader` = '%d', `facduty` = '%d', `bank` = '%d', `family` = '%i', `boughtvehicle` = '%d', `bounty` = '%d', `lighters` = '%d' WHERE `userID` = '%d'", szQuery, CharacterData[playerid][pLeader], CharacterData[playerid][pFacDuty], CharacterData[playerid][pBank], CharacterData[playerid][pFamily], CharacterData[playerid][pGotVehicle], CharacterData[playerid][pBounty], CharacterData[playerid][pLighters], CharacterData[playerid][pSQLID]);
mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "UPDATE `characters` SET `failedhits` = '%d', `completedhits` = '%d', `username` = '%e', `prisonedBy` = '%e', `prisonReason` = '%e', `blindfolds` = '%d', `ciggerettes` = '%d'", CharacterData[playerid][pFailedHits], CharacterData[playerid][pCompletedHits], CharacterData[playerid][pUsername], CharacterData[playerid][pPrisonedBy], CharacterData[playerid][pPrisonReason], CharacterData[playerid][pBlindFolds],
CharacterData[playerid][pCiggerettes]);
printf("Debug: %s", CharacterData[playerid][pUsername]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `hungrylevel` = '%d', `dealerID` = '%d', `phonebook` = '%d', `adressbook` = '%d', `ties` = '%d', `paycheckamount` = '%d', `armsdealerskill` = '%d', `newbietag` = '%d'", szQuery, CharacterData[playerid][pHungryLevel], CharacterData[playerid][pDealerID], CharacterData[playerid][pPhoneBook], CharacterData[playerid][pAdressBook], CharacterData[playerid][pTies],
CharacterData[playerid][pPayCheckAmount], CharacterData[playerid][pArmsDealerSkill], CharacterData[playerid][pNewbieTag]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `baking` = '%d', `nitro` = '%d' WHERE `userID` = '%d'", szQuery, CharacterData[playerid][pBakingPowder], CharacterData[playerid][pNitroxide], CharacterData[playerid][pSQLID]);
return mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, playerid);
}
// ----- [ STOCK FUNCTIONS ] -----
Sorry for that, i edit code type.
So what should i do ? should i remove SaveContacts(playerid); on that line ?
Код:
SaveContacts(playerid)
{
for (new t = 1; t < MAX_CONTACTS; t ++)
{
if (!strlen(PhoneContactData[playerid][t][phone_ContactNumber]))
{
format(PhoneContactData[playerid][t][phone_ContactName], 5, "None");
}
}
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "UPDATE `contacts` SET `Contact1` = '%s', `Contact2` = '%s', `Contact3` = '%s', `Contact4` = '%s'", PhoneContactData[playerid][1][phone_ContactName], PhoneContactData[playerid][2][phone_ContactName], PhoneContactData[playerid][3][phone_ContactName], PhoneContactData[playerid][4][phone_ContactName]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `Contact5` = '%s', `Contact6` = '%s', `Contact7` = '%s', `Contact8` = '%s'", szQuery, PhoneContactData[playerid][5][phone_ContactName], PhoneContactData[playerid][6][phone_ContactName], PhoneContactData[playerid][7][phone_ContactName], PhoneContactData[playerid][8][phone_ContactName]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `Contact9` = '%s', `Contact10` = '%s'", szQuery, PhoneContactData[playerid][9][phone_ContactName], PhoneContactData[playerid][10][phone_ContactName]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `ContactNumber1` = '%d', `ContactNumber2` = '%d', `ContactNumber3` = '%d', `ContactNumber4` = '%d'", szQuery, PhoneContactData[playerid][1][phone_ContactNumber], PhoneContactData[playerid][2][phone_ContactNumber], PhoneContactData[playerid][3][phone_ContactNumber], PhoneContactData[playerid][4][phone_ContactNumber]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `ContactNumber5` = '%d', `ContactNumber6` = '%d', `ContactNumber7` = '%d', `ContactNumber8` = '%d' ", szQuery, PhoneContactData[playerid][5][phone_ContactNumber], PhoneContactData[playerid][6][phone_ContactNumber], PhoneContactData[playerid][7][phone_ContactNumber], PhoneContactData[playerid][8][phone_ContactNumber]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s, `ContactNumber9` = '%d', `ContactNumber10` = '%d'", szQuery, PhoneContactData[playerid][9][phone_ContactNumber], PhoneContactData[playerid][10][phone_ContactNumber]);
mysql_format(MainPipeline, szQuery, sizeof(szQuery), "%s WHERE `ownerID` = '%d'", szQuery, CharacterData[playerid][pSQLID]);
return mysql_function_query(MainPipeline, szQuery, true, "OnQueryFinish", "ii", THREAD_NO_RESULT, CharacterData[playerid][pSQLID]);
}
I'd personally be checking the MySQL server, or the mysql log that may be in the sa-mp server folder somewhere.
Best that you learn, rather than have it done for you. (Also quite dangerous to simply allow people to be connecting to you)
Check if there is a log file for the MySQL in your samp-server folder. There will be other members that will turn up in this thread that will be able to fully help.
I'm not so good with MySQL, but am more aiming toward the troubleshooting side.
As I said, the error seems to point to a dropped connection, so that could be that the MySQL server is having an issue, or it could be a connection issue resulting from the code, or from a bad pipe between your game server, and the MySQL server itself.