Spieler Speichern, Laden, rücksetzen disconnect.

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
  • Ich habe folgendes Problem das wenn ich mir was ingame Kaufe wird der geld wert von 1500$ zwar abgezogen dann aber nicht gespeichert und somit wieder auf 1500$ gesetzt.


    So sieht es aus:
    savePlayer(playerid)
    {
    if(sInfo[playerid][eingeloggt]==0)return 1;
    //speichern level,money
    new query[128];
    format(query,sizeof(query),"UPDATE user SET level= '%i', money= '%i', alevel= '%i', fraktion= '%i', rang= '%i' WHERE `id` ='%i'",sInfo[playerid][level],GetPlayerMoney(playerid),sInfo[playerid][alevel],sInfo[playerid][fraktion],sInfo[playerid][rang],sInfo[playerid][db_id]);
    mysql_function_query(dbhandle,query,false,"","");
    return 1;
    }


    resetPlayer(playerid)
    {
    for(new i=0; i<sizeof(sInfo[]); i++)
    {
    sInfo[playerid][playerInfo:i]=0;
    loadPlayerCars(playerid);
    }
    return 1;
    }


    public OnPlayerDisconnect(playerid, reason)
    {
    for(new i=0; i<sizeof(aInfo); i++)
    {
    if(aInfo[i][id_x]==0)continue;
    if(aInfo[i][besitzer]!=sInfo[playerid][db_id])continue;
    GetVehiclePos(aInfo[i][id_x],aInfo[i][c_x],aInfo[i][c_y],aInfo[i][c_z]);
    GetVehicleZAngle(aInfo[i][id_x],aInfo[i][c_r]);
    new query[128];
    format(query,sizeof(query),"UPDATE autos SET x='%f', y='%f', z='%f', r='%f' WHERE id='%i' ",aInfo[i][c_x],aInfo[i][c_y],aInfo[i][c_z],aInfo[i][c_r],aInfo[i][db_id]);
    mysql_function_query(dbhandle,query,false,"","");
    DestroyVehicle(aInfo[i][id_x]);
    aInfo[i][id_x]=0;
    break;
    }
    resetPlayer(playerid);
    savePlayer(playerid);
    loadPlayerCars(playerid);
    return 1;
    }


    Das hier gehört auch noch dazu:


    SetPlayerMoney(playerid,money)
    {
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,money);
    return 1;
    }
    public OnPasswordResponse(playerid)
    {
    new num_rows,num_fields;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows==1)
    {
    //passwort Richtig
    sInfo[playerid][eingeloggt] = 1;
    sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle);
    SetPlayerScore(playerid,sInfo[playerid][level]);
    sInfo[playerid][db_id] = cache_get_field_content_int(0,"id",dbhandle);
    SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle));
    sInfo[playerid][alevel] = cache_get_field_content_int(0,"alevel",dbhandle);
    sInfo[playerid][fraktion] = cache_get_field_content_int(0,"fraktion",dbhandle);
    sInfo[playerid][rang] = cache_get_field_content_int(0,"rang",dbhandle);


    //autosladen:
    loadPlayerCars(playerid);


    }
    else
    {
    //Passwort Falsch
    SendClientMessage(playerid,grün,"Du hast dein Passwort falsch eingetippt. Versuche es nochmal!");
    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login","Gibt bitte dein Passwort ein:","Anmelden","Abbrechen");
    }
    return 1;
    }

  • Das steht in der Server.log:




    Das steht in der mysql.log:

    SQL
    [20:14:22] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0'' at line 1
    [20:19:32] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' WHERE id='2000'' at line 1
    [20:19:32] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0'' at line 1
    [20:24:37] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' WHERE id='2000'' at line 1
    [20:24:37] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0'' at line 1
  • der macht es immer noch nicht


    Mysql.log:

    SQL
    [20:33:00] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' WHERE id='2000'' at line 1
    [20:33:00] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0'' at line 1
  • savePlayer(playerid)
    {
    if(sInfo[playerid][eingeloggt]==0)return 1;
    //speichern level,money
    new query[256];
    format(query,sizeof(query),"UPDATE user SET level='%i', money='%i', alevel='%i', fraktion='%i', rang='%i' WHERE id='%i'",sInfo[playerid][level],GetPlayerMoney(playerid),sInfo[playerid][alevel],sInfo[playerid][fraktion],sInfo[playerid][rang],sInfo[playerid][db_id]);
    printf("Query: %s", query);
    mysql_function_query(dbhandle,query,false,"","");
    return 1;
    }

    Was steht im Server Log?

  • mysql.log:

    SQL
    [20:46:01] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0' WHERE id='2000'' at line 1



    server.log: