Speicherungsfehler?

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hey Leute,
    ich habe gerade auf meinen Server connectet,
    doch als ich mich registrieren wollte und dann disconnectet habe,
    hat MySQL für jede Zeile beim Speichern dies geprintet:

    SQL
    [13:51:29] CMySQLHandler::Query(UPDATE `accounts` SET `Position_X` = '1766.111938' WHERE `Name` = 'Lars') - An error has occured. (Error ID: 2014, Commands out of sync; you can't run this command now)


    Und das komplett so und ich weiß nicht wieso, hat jemand von euch vielleicht ne Ahnung?
    MfG Larso99

    Einmal editiert, zuletzt von Larso99 ()

  • Hier der Savestock:
    stock SavePlayer(playerid)
    {
    if(IsPlayerConnected(playerid) && !IsPlayerNPC(playerid))
    {
    if(GetPVarInt(playerid,"Eingeloggt") == 1)
    {
    new Float:x;
    new Float:y;
    new Float:z;
    GetPlayerPos(playerid,x,y,z);
    PlayerInfo[playerid][pPosX] = x;
    PlayerInfo[playerid][pPosY] = y;
    PlayerInfo[playerid][pPosZ] = z;



    mysql_SetInt("accounts", "MinutesAfterPayday", PlayerInfo[playerid][pMinutesAfterPayday], "Name", pName);
    mysql_SetInt("accounts", "Respektpunkte", PlayerInfo[playerid][pRespektpunkte], "Name", pName);
    mysql_SetInt("accounts", "TimeAfterRegister", PlayerInfo[playerid][pTimeAfterRegister], "Name", pName);
    mysql_SetInt("accounts", "Level", GetPlayerScore(playerid), "Name", pName);
    mysql_SetInt("accounts", "Adminlevel", PlayerInfo[playerid][pAdmin], "Name", pName);
    mysql_SetInt("accounts", "Fraktion", PlayerInfo[playerid][pFraktion], "Name", pName);
    mysql_SetInt("accounts", "Skin", PlayerInfo[playerid][pSkin], "Name", pName);
    mysql_SetInt("accounts", "Job", PlayerInfo[playerid][pJob], "Name", pName);
    mysql_SetInt("accounts", "Leader", PlayerInfo[playerid][pLeader], "Name", pName);
    mysql_SetInt("accounts", "Member", PlayerInfo[playerid][pMember], "Name", pName);
    mysql_SetInt("accounts", "Geschlecht", PlayerInfo[playerid][pGeschlecht], "Name", pName);
    mysql_SetInt("accounts", "Alter", PlayerInfo[playerid][pAlter], "Name", pName);
    mysql_SetInt("accounts", "Geld", PlayerInfo[playerid][pGeld], "Name", pName);
    mysql_SetInt("accounts", "Gebannt", PlayerInfo[playerid][pBanned], "Name", pName);
    mysql_SetInt("accounts", "Handybesitzer", PlayerInfo[playerid][pHandy], "Name", pName);
    mysql_SetInt("accounts", "Handynummer", PlayerInfo[playerid][pHandyNr], "Name", pName);
    mysql_SetInt("accounts", "Führerschein", PlayerInfo[playerid][pAutoFS], "Name", pName);
    mysql_SetInt("accounts", "Waffenschein", PlayerInfo[playerid][pWaffenFS], "Name", pName);
    mysql_SetInt("accounts", "Flugschein", PlayerInfo[playerid][pFlugFS], "Name", pName);
    mysql_SetInt("accounts", "Segelschein", PlayerInfo[playerid][pBootFS], "Name", pName);
    mysql_SetInt("accounts", "Bikeschein", PlayerInfo[playerid][pBikeFS], "Name", pName);
    mysql_SetInt("accounts", "Truckschein", PlayerInfo[playerid][pLKWFS], "Name", pName);
    mysql_SetFloat("accounts", "Position_X", PlayerInfo[playerid][pPosX], "Name", pName);
    mysql_SetFloat("accounts", "Position_Y", PlayerInfo[playerid][pPosY], "Name", pName);
    mysql_SetFloat("accounts", "Position_Z", PlayerInfo[playerid][pPosZ], "Name", pName);
    mysql_SetInt("accounts", "InteriorID", GetPlayerInterior(playerid), "Name", pName);
    }
    }
    return 1;
    }
    Beim Laden hat er ja keine Probleme lediglich beim speichern.

  • Hier beides direkt, SetFloat und SetInt:


    stock mysql_SetFloat(Table[], Field[], Float:To, Where[], Where2[])
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Where2, Where2);
    format(query, 128, "UPDATE `%s` SET `%s` = '%f' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
    mysql_query(query);
    return 1;
    }
    stock mysql_SetInt(Table[], Field[], To, Where[], Where2[])
    {
    new query[128];
    mysql_real_escape_string(Table, Table);
    mysql_real_escape_string(Field, Field);
    mysql_real_escape_string(Where, Where);
    mysql_real_escape_string(Where2, Where2);
    format(query, 128, "UPDATE `%s` SET `%s` = '%d' WHERE `%s` = '%s'", Table, Field, To, Where, Where2);
    mysql_query(query);
    return true;
    }

  • Die OnPlayerDisconnect-Funktion sieht so aus:
    public OnPlayerDisconnect(playerid, reason)
    {
    SavePlayer(playerid);
    DeletePVar(playerid,"Eingeloggt");
    DOO_OnPlayerDisconnect(playerid);
    OnGameModeSave();
    new Float:X,Float:Z,Float:Y,Float:A;
    GetVehiclePos(pAutoInfo[playerid][Carid],X,Y,Z);
    GetVehicleZAngle(pAutoInfo[playerid][Carid],A);
    pAutoInfo[playerid][pAUTOPoS_X] = X;
    pAutoInfo[playerid][pAUTOPoS_Y] = Y;
    pAutoInfo[playerid][pAUTOPoS_Z] = Z;
    pAutoInfo[playerid][pAUTOPoS_A] = A;
    SaveAuto(playerid);
    PlayerTextDrawDestroy(playerid,VEHJOBTANKdraw[playerid]);
    for(new i=0;i<19;i++){ PlayerTextDrawDestroy(playerid,Tacho[playerid][i]); }
    if(Spieler[playerid][pTankArt] != 0)
    {
    RefillVehicle[Spieler[playerid][pTankVehicle]] = 0;
    Delete3DTextLabel(TankenLabel[Spieler[playerid][pTankVehicle]]);
    vFahrzeug[Spieler[playerid][pTankVehicle]][Tank] = Tankcount[playerid];
    Spieler[playerid][pTankArt] = 0;
    Spieler[playerid][pTankVehicle] = 0;
    Spieler[playerid][pTankState] = false;
    Tankcount[playerid] = 0;
    }
    if(IsPlayerNPC(playerid)) return 1;
    DeletePVar(playerid,"Eingeloggt");
    return 1;
    }
    }