MySQL UPDATE threaded queries problem
#1

I'm facing some problems with them:
pawn Код:
//OnPlayerDisconnect
mySQL_SaveData(MYSQL_SAVE_PLAYER_DATA, playerid);
UnloadPlayerVehicles(playerid);
pawn Код:
//UnloadPlayerVehicles stock
stock UnloadPlayerVehicles(playerid) {
    foreach(new i : Vehicles) {
        new next;
        if(!strcmp(E_VEHICLE[i][vOwner], GetName(playerid), true)) {
            mySQL_SaveData(MYSQL_SAVE_VEHICLE, i);
            Iter_SafeRemove(Vehicles, i, next);
           
            DestroyVehicle(i);
            ResetVehicleVariables(i);

            i = next;
        }
    }
}
pawn Код:
//mySQL_SaveData
stock mySQL_SaveData(dataid, data_saveid) {
    switch(dataid) {
        case MYSQL_SAVE_VEHICLE: {
            format(E_STRING[szVehicleUpdateString], sizeof E_STRING[szVehicleUpdateString], "UPDATE vehicles SET pos_x=%f, pos_y=%f, pos_z=%f, pos_a=%f, color1=%d, color2=%d, owner='%s', mileage=%.1f, gas=%d, locked=%d, vworld=%d, interior=%d WHERE plate='%s'",
            E_VEHICLE[data_saveid][vPosition][0], E_VEHICLE[data_saveid][vPosition][1], E_VEHICLE[data_saveid][vPosition][2], E_VEHICLE[data_saveid][vPosition][3], E_VEHICLE[data_saveid][vColors][0], E_VEHICLE[data_saveid][vColors][1], E_VEHICLE[data_saveid][vOwner], E_VEHICLE[data_saveid][vMileage],
            E_VEHICLE[data_saveid][vGas], E_VEHICLE[data_saveid][vLocked], E_VEHICLE[data_saveid][vVirtualWorld], E_VEHICLE[data_saveid][vInterior], E_VEHICLE[data_saveid][vPlate]);
            mysql_tquery(dbHandle, E_STRING[szVehicleUpdateString]);
        }

        case MYSQL_SAVE_PLAYER_DATA: {
            if(E_PTEMP[data_saveid][pStatus] == STATUS_LOGGED_IN) {
                format(E_STRING[szPlayerUpdateString], sizeof E_STRING[szPlayerUpdateString], "UPDATE users SET admin=%d, level=%d, cash=%d, bank=%d, skin=%d, kills=%d, deaths=%d, mutetime=%d, `group`=%d, `grouprank`=%d, playedtime=%d, materials=%d, drugs=%d, registered=%d, phone_nr=%d, lastlogin=%d, age=%d, sex=%d, birth_day=%d, birth_month=%d, register_date=%d, ",
                E_PLAYER[data_saveid][pAdmin], E_PLAYER[data_saveid][pLevel], E_PLAYER[data_saveid][pCash], E_PLAYER[data_saveid][pBank], E_PLAYER[data_saveid][pSkin], E_PLAYER[data_saveid][pKills], E_PLAYER[data_saveid][pDeaths], E_PLAYER[data_saveid][pMuteTime], E_PLAYER[data_saveid][pGroup], E_PLAYER[data_saveid][pGroupRank],
                E_PLAYER[data_saveid][pPlayedTime], E_PLAYER[data_saveid][pMaterials], E_PLAYER[data_saveid][pDrugs], E_PLAYER[data_saveid][pRegistered], E_PLAYER[data_saveid][pCellphone], E_PLAYER[data_saveid][pLastLogin], E_PLAYER[data_saveid][pAge], E_PLAYER[data_saveid][pSex], E_PLAYER[data_saveid][pDate][0], E_PLAYER[data_saveid][pDate][1], E_PLAYER[data_saveid][pRegisterDate]);

                format(E_STRING[szPlayerUpdateString], sizeof E_STRING[szPlayerUpdateString], "%scardpassword=%d, civspawn=%d, tutorial=%d, wanted_lvl=%d, burglar_time=%d, war_id=%d, war_kills=%d, jailed=%d, jail_time=%d, crimes=%d, arrests=%d, wanted_deaths=%d, bail_price=%d, credit=%d, swat=%d, fuel_can=%d, drivers_lic=%d, weapon_lic=%d, shop_skin=%d, lottery=%d, on‌line=%d, spawn_loc=%d, f_spawn=%d, ",
                E_STRING[szPlayerUpdateString], E_PLAYER[data_saveid][pCardPassword], E_PLAYER[data_saveid][pCivilianSpawn], E_PLAYER[data_saveid][pTutorial], E_PLAYER[data_saveid][pWantedLevel], E_PLAYER[data_saveid][pBurglarTime], E_PLAYER[data_saveid][pWarParticipating], E_PLAYER[data_saveid][pWarKills],
                E_PLAYER[data_saveid][pJailed], E_PLAYER[data_saveid][pJailTime], E_PLAYER[data_saveid][pCrimes], E_PLAYER[data_saveid][pArrests], E_PLAYER[data_saveid][pWantedDeaths], E_PLAYER[data_saveid][pBail], E_PLAYER[data_saveid][pCredit], E_PLAYER[data_saveid][pSwatRank], E_PLAYER[data_saveid][pFuel], E_PLAYER[data_saveid][pDriversLicense], E_PLAYER[data_saveid][pWeaponLicense], E_PLAYER[data_saveid][pShopSkin],
                E_PLAYER[data_saveid][pLottery], !!E_PLAYER[data_saveid][pOnline], E_PLAYER[data_saveid][pSpawnLocation], E_PLAYER[data_saveid][pFactionSpawn]);
               
                format(E_STRING[szPlayerUpdateString], sizeof E_STRING[szPlayerUpdateString], "%sm_pills=%d, pill=%d, rope=%d, seeds=%d, m_packages=%d, c_value=%d WHERE `id`=%d LIMIT 1", E_STRING[szPlayerUpdateString], E_PLAYER[data_saveid][pMedicPills], E_PLAYER[data_saveid][pPill], E_PLAYER[data_saveid][pRope], E_PLAYER[data_saveid][pSeeds], E_PLAYER[data_saveid][pPackages], E_PLAYER[data_saveid][pContractValue], E_PLAYER[data_saveid][pSQLID]);
               
                mysql_tquery(dbHandle, E_STRING[szPlayerUpdateString]);
            }
        }
    }
    return 1;
}
edit: the problem is that only at gmx that thing happens.. when I quit it seems to work correctly now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)