MySQL Plugin Crash
#1

Hi SAMP members,

Well I don't know what is happening with my server, but there is command "update" I've made, and sometimes it works some times it crashes server.

I use MySQL R6 plugin

Here is crashdetect plugin log:
Код:
[14:11:14] [debug] Server crashed while executing roleplay.amx
[14:11:14] [debug] AMX backtrace:
[14:11:14] [debug] #0 0009ac7c in ?? () from roleplay.amx
[14:11:14] [debug] #1 0000e818 in public cmd_update () from roleplay.amx
[14:11:14] [debug] #2 native CallLocalFunction () [080d2870] from samp03svr
[14:11:14] [debug] #3 000071cc in public OnPlayerCommandText () from roleplay.amx
[14:11:14] [debug] System backtrace:
[14:11:14] [debug] #0 f677835b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[14:11:14] [debug] #1 f6771389 in _ZN11crashdetect20PrintSystemBacktraceEPv () from plugins/crashdetect.so
[14:11:14] [debug] #2 f67738ed in _ZN11crashdetect11OnExceptionEPv () from plugins/crashdetect.so
[14:11:14] [debug] #3 f6777e68 in ?? () from plugins/crashdetect.so
[14:11:14] [debug] #4 f7765410 in ?? ()
[14:11:14] [debug] #5 f72043cc in net_real_write () from plugins/mysql.so
[14:11:14] [debug] #6 f7204798 in net_flush () from plugins/mysql.so
[14:11:14] [debug] #7 f7204948 in net_write_command () from plugins/mysql.so
[14:11:14] [debug] #8 f72014ac in cli_advanced_command () from plugins/mysql.so
[14:11:14] [debug] #9 f71fdba7 in mysql_send_query () from plugins/mysql.so
[14:11:14] [debug] #10 f71fdc40 in mysql_real_query () from plugins/mysql.so
[14:11:14] [debug] #11 f71ddda0 in _Z18ProcessQueryThreadPv () from plugins/mysql.so
[14:11:14] [debug] #12 f770ed4c in ?? () from /lib/i386-linux-gnu/libpthread.so.0
[14:11:14] [debug] #13 f750ed3e in clone () from /lib/i386-linux-gnu/libc.so.6
And here is "update" command:
pawn Код:
CMD:update(playerid, params[]){
    if(!IsPlayerAdministrator(playerid, 4)) return true;
    SendTranslate(playerid, COLOR_YELLOW, "Saving player stats...");
    for(new PlayerID=0;PlayerID<MAX_PLAYERS;PlayerID++){
        if(IsPlayerConnected(PlayerID) && pLogged[PlayerID]){
            StatsSaving[PlayerID] = true;
            SavePlayerStats(PlayerID);
        }else continue;
    }
    SendTranslate(playerid, COLOR_GREEN, "Player stats saved.");
    SendTranslate(playerid, COLOR_YELLOW, "Saving houses...");
    for(new HouseID=1;(HouseID+1)<sizeof(HouseInfos);HouseID++){
        UpdateHouse(HouseID);
    }
    SendTranslate(playerid, COLOR_GREEN, "Houses saved...");
    SendTranslate(playerid, COLOR_YELLOW, "Saving business...");
    for(new BusinessID=1;(BusinessID+1)<sizeof(BusinessInfos);BusinessID++){
        UpdateBusiness(BusinessID);
    }
    SendTranslate(playerid, COLOR_GREEN, "Business saved...");
    return true;
}
It crashes after calling SavePlayerStats function. And there for here is my SavePlayerStats function.
pawn Код:
stock SavePlayerStats(playerid){
    new SaveQuery[1024];
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `DisplayName` = '%s', `Password` = '%s', `Gender` = %d, `Age` = %d, `Skin` = %d, `Level` = %d, `Points` = %d WHERE `ID` = %d", PlayerInfos[playerid][pDisplayName], PlayerInfos[playerid][pPassword], PlayerInfos[playerid][pGender], PlayerInfos[playerid][pAge], PlayerInfos[playerid][pSkin], PlayerInfos[playerid][pLevel], PlayerInfos[playerid][pPoints], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Banned` = %d, `Bans` = %d, `Kicks` = %d, `Mask` = %d, `HasMask` = %d, `Administrator` = %d, `Helper` = %d, `Donator` = %d WHERE `ID` = %d", PlayerInfos[playerid][pBanned], PlayerInfos[playerid][pBans], PlayerInfos[playerid][pKicks], PlayerInfos[playerid][pMask], PlayerInfos[playerid][pHasMask], PlayerInfos[playerid][pAdministrator], PlayerInfos[playerid][pHelper], PlayerInfos[playerid][pDonator], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Money` = %d, `Bank` = %d, `Spawn_X` = %f, `Spawn_Y` = %f, `Spawn_Z` = %f, `Interior` = %d, `VirtualWorld` = %d, `Crashed` = %d WHERE `ID` = %d", PlayerInfos[playerid][pMoney], PlayerInfos[playerid][pBank], PlayerInfos[playerid][pSpawnX], PlayerInfos[playerid][pSpawnY], PlayerInfos[playerid][pSpawnZ], PlayerInfos[playerid][pInt], PlayerInfos[playerid][pVirtualWorld], PlayerInfos[playerid][pCrashed], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `HouseKey` = %d, `BusinessKey` = %d, `Faction` = %d, `Rank` = %d, `Leader` = %d, `Job` = %d WHERE `ID` = %d", PlayerInfos[playerid][pHouseKey], PlayerInfos[playerid][pBusinessKey], PlayerInfos[playerid][pFaction], PlayerInfos[playerid][pRank], PlayerInfos[playerid][pLeader], PlayerInfos[playerid][pJob], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `ContractTime` = %d, `Food` = %d, `Down` = %d, `DownX` = %f, `DownY` = %f, `DownZ` = %f, `DownInt` = %d, `DownViwo` = %d WHERE `ID` = %d", PlayerInfos[playerid][pContractTime], PlayerInfos[playerid][pFood], PlayerInfos[playerid][pDown], PlayerInfos[playerid][pDownX], PlayerInfos[playerid][pDownY], PlayerInfos[playerid][pDownZ], PlayerInfos[playerid][pDownInt], PlayerInfos[playerid][pDownViwo], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Health` = %f, `Armour` = %f, `PayDay` = %d, `PayDayMoney` = %d, `Suspect` = %d, `PrisonTime` = %d WHERE `ID` = %d", PlayerInfos[playerid][pHealth], PlayerInfos[playerid][pArmour], PlayerInfos[playerid][pPayDay], PlayerInfos[playerid][pPayDayMoney], PlayerInfos[playerid][pSuspect], PlayerInfos[playerid][pPrisonTime], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `MobileModel` = %d, `MobileNumber` = %d, `MobileMoney` = %d, `BuildMaterial` = %d, `RepairMaterial` = %d WHERE `ID` = %d", PlayerInfos[playerid][pMobileModel], PlayerInfos[playerid][pMobileNumber], PlayerInfos[playerid][pMobileMoney], PlayerInfos[playerid][pBuildMaterials], PlayerInfos[playerid][pRepairMaterials], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Insurance` = %d, `HouseRentKey` = %d, `CarKey` = %d, `Rope` = %d, `Cigaretes` = %d, `Lighter` = %d, `Bat` = %d WHERE `ID` = %d", PlayerInfos[playerid][pInsurance], PlayerInfos[playerid][pHouseRentKey], PlayerInfos[playerid][pCarKey], PlayerInfos[playerid][pRope], PlayerInfos[playerid][pCigaretes], PlayerInfos[playerid][pLighter], PlayerInfos[playerid][pBat], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Helmet` = %d, `FishRod` = %d, `FishHook` = %d, `FishBait` = %d, `ToolKit` = %d, `Token` = %d, `Watch` = %d, `Fish` = %d WHERE `ID` = %d",  PlayerInfos[playerid][pHelmet], PlayerInfos[playerid][pFishRod], PlayerInfos[playerid][pFishHook], PlayerInfos[playerid][pFishBait], PlayerInfos[playerid][pToolKit], PlayerInfos[playerid][pToken], PlayerInfos[playerid][pWatch], PlayerInfos[playerid][pFish], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Language` = %d, `Materials` = %d, `Fines` = %d, `Hunger` = %f , `RoomKey` = %d, `Rip` = %d WHERE `ID` = %d", PlayerInfos[playerid][pLanguage], PlayerInfos[playerid][pMaterials], PlayerInfos[playerid][pFines], PlayerInfos[playerid][pHunger], PlayerInfos[playerid][pRoomKey], PlayerInfos[playerid][pRip], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `DrivingLic` = %d, `FlyingLic` = %d, `WeaponLic` = %d, `BoatLic` = %d, `Radio` = %d, `RadioFerq` = %d, `BankCredit` = %d WHERE `ID` = %d;", PlayerInfos[playerid][pDrivingLic], PlayerInfos[playerid][pFlyingLic], PlayerInfos[playerid][pWeapLic], PlayerInfos[playerid][pBoatLic], PlayerInfos[playerid][pRadio], PlayerInfos[playerid][pRadioFreq], PlayerInfos[playerid][pBankCredit], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Strength` = %f, `Bomb` = %d, `SpawnID` = %d, `Hair` = %d, `Energy` = %d, `Dirty` = %d WHERE `ID` =%d;", PlayerInfos[playerid][pStrength], PlayerInfos[playerid][pBomb], PlayerInfos[playerid][pSpawn], PlayerInfos[playerid][pHair], PlayerInfos[playerid][pEnergy], PlayerInfos[playerid][pDirty], PlayerInfos[playerid][pSQLID]);
    if(!mysql_query(SaveQuery)) StatsSaving[playerid] = true;
    format(SaveQuery, sizeof(SaveQuery), "UPDATE "TABLE_PLAYERS" SET `Pissed` = %d WHERE `ID` =%d;", PlayerInfos[playerid][pPissed], PlayerInfos[playerid][pSQLID]);
    mysql_query(SaveQuery, SAVE_PLAYER_QUERY, playerid);
    return true;
}
If some one knows how to solve this problem, please help, all regards.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)