Beiträge von Blackshadowscript

    Server.log:

    ----------
    Loaded log file: "server_log.txt".
    ----------


    SA-MP Dedicated Server
    ----------------------
    v0.3.7, (C)2005-2015 SA-MP Team


    [20:49:01] filterscripts = "" (string)
    [20:49:01]
    [20:49:01] Server Plugins
    [20:49:01] --------------
    [20:49:01] Loading plugin: mysql
    [20:49:01] >> plugin.mysql: R39 successfully loaded.
    [20:49:01] Loaded.
    [20:49:01] Loading plugin: sscanf
    [20:49:01]


    [20:49:01] ===============================


    [20:49:01] sscanf plugin loaded.


    [20:49:01] (c) 2009 Alex "Y_Less" Cole


    [20:49:01] 0.3d-R2 500 Players "dnee"


    [20:49:01] ===============================


    [20:49:01] Loaded.
    [20:49:01] Loaded 2 plugins.


    [20:49:01]
    [20:49:01] Ban list
    [20:49:01] --------
    [20:49:01] Loaded: samp.ban
    [20:49:01]
    [20:49:01]
    [20:49:01] Filterscripts
    [20:49:01] ---------------
    [20:49:01] Loaded 0 filterscripts.


    [20:49:01] Mysql wurde verbunden!
    [20:49:01]
    ----------------------------------
    [20:49:01] Exilium Reallife Version 1.0
    [20:49:01] ----------------------------------


    [20:49:01] Number of vehicle models: 6
    [20:49:33] [connection] 127.0.0.1:59366 requests connection cookie.
    [20:49:34] Incoming connection: 127.0.0.1:59366 id: 0
    [20:49:34] [join] Blackshadowscript has joined the server (0:127.0.0.1)
    [20:50:14] i: 0 | vID: 7 | idx: 7
    [20:50:14] besitzer: ÿlackshadowscript | SpielerName:

    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:

    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

    Autoparken:
    ocmd:autoparken(playerid, params[])
    {
    new vID = GetPlayerVehicleID(playerid);
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, hellgrün, "Du bist in kein Auto!");
    for (new i = 0; i < sizeof(aInfo); i++)
    {
    if(vID == aInfo[i] [id_x])
    {
    if(!strcmp(aInfo[i][besitzer], SpielerName(playerid)))
    {
    new query[128];
    GetVehiclePos(vID, aInfo[i][c_x],aInfo[i][c_y],aInfo[i][c_z]);
    GetVehicleZAngle(vID,aInfo[i][c_r]);
    format(query, sizeof(query), "UPDATE Autos SET c_x='%f',c_y='%f',c_z='%f',c_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," "," ");
    SendClientMessage(playerid, hellgrün, "Du hast dein Auto geparkt.");
    return 1;
    }
    break;
    }
    }
    return SendClientMessage(playerid, hellgrün, "Du sitzt nicht in deinem Auto!");
    }



    ich glaube du meinst das hier:


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    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

    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;
    }

    MYSQL.Log:





    Server.log:

    ----------
    Loaded log file: "server_log.txt".
    ----------


    SA-MP Dedicated Server
    ----------------------
    v0.3.7, (C)2005-2015 SA-MP Team


    [05/06/2015 16:38:59]
    [05/06/2015 16:38:59] Server Plugins
    [05/06/2015 16:38:59] --------------
    [05/06/2015 16:38:59] Loading plugin: streamer.so
    [05/06/2015 16:38:59]


    *** Streamer Plugin v2.6.1 by Incognito loaded ***


    [05/06/2015 16:38:59] Loaded.
    [05/06/2015 16:38:59] Loading plugin: sscanf.so
    [05/06/2015 16:38:59]


    [05/06/2015 16:38:59] ===============================


    [05/06/2015 16:38:59] sscanf plugin loaded.


    [05/06/2015 16:38:59] Version: 2.8.1


    [05/06/2015 16:38:59] (c) 2012 Alex "Y_Less" Cole


    [05/06/2015 16:38:59] ===============================


    [05/06/2015 16:38:59] Loaded.
    [05/06/2015 16:38:59] Loading plugin: mysql.so
    [05/06/2015 16:38:59] >> plugin.mysql: running on 4 threads.
    [05/06/2015 16:38:59] >> plugin.mysql: R31 successfully loaded.
    [05/06/2015 16:38:59] Loaded.
    [05/06/2015 16:38:59] Loaded 3 plugins.


    [05/06/2015 16:38:59]
    [05/06/2015 16:38:59] Ban list
    [05/06/2015 16:38:59] --------
    [05/06/2015 16:38:59] Loaded: samp.ban
    [05/06/2015 16:38:59]
    [05/06/2015 16:38:59]
    [05/06/2015 16:38:59] Filterscripts
    [05/06/2015 16:38:59] ---------------
    [05/06/2015 16:38:59] Loaded 0 filterscripts.


    [05/06/2015 16:38:59] Mysql wurde verbunden!
    [05/06/2015 16:38:59]
    ----------------------------------
    [05/06/2015 16:38:59] Exilium Reallife Version 1.0
    [05/06/2015 16:38:59] ----------------------------------


    [05/06/2015 16:38:59] Number of vehicle models: 6

    jetzt taucht bei:


    ocmd:autoentfernen(playerid, params[])
    {
    new vID = GetPlayerVehicleID(playerid);
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, hellgrün, "Du bist in kein Auto!");
    for (new i = 0; i < sizeof(aInfo); i++)
    {
    if(vID == aInfo[i] [id_x])
    {
    if(!strcmp(aInfo[i][besitzer], SpielerName(playerid)))
    {
    new query[128];
    format(query, sizeof(query), "DELETE FROM autos WHERE id='%i'",aInfo[i][db_id]);
    mysql_function_query(dbhandle,query,false," "," ");
    DestroyVehicle(aInfo[i][besitzer]);
    aInfo[i][autoEnum] = 0;
    SendClientMessage(playerid, hellgrün, "Du hast dein Auto entfernt.");
    return 1;
    }
    break;
    }
    }
    return SendClientMessage(playerid, hellgrün, "Du sitzt nicht in deinem Auto!");
    }


    Fehler:
    samplernen.p(992) : error 032: array index out of bounds (variable "aInfo")

    auf

    Also mein Startwert is 999541$ wenn ich mein autorepariere beim Pay´N Spray was mich ja 100$ kostet sollte ich normal bei 999441$ sein aber bekomme immer wieder 999541$ und habe echt kein plan woran das jetzt liegt

    Guten Tag.


    Mir ist jetzt mein Befehl um Fahrzeuge zu parken



    Enum:
    enum autoEnum{
    id_x,
    model,
    besitzer[MAX_PLAYER_NAME],
    Float:c_x,
    Float:c_y,
    Float:c_z,
    Float:c_r,
    db_id
    }


    new aInfo[50][autoEnum];



    Befehl um die Fahrzeuge zu parken:


    ocmd:autoparken(playerid, params[])
    {
    new vID = GetPlayerVehicleID(playerid);
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, hellgrün, "Du bist in kein Auto!");
    for (new i = 0; i < sizeof(aInfo); i++)
    {
    if(vID == aInfo[i] [autoEnum])
    {
    if(!strcmp(aInfo[i][besitzer], SpielerName(playerid)))
    {
    new query[128];
    GetVehiclePos(vID, aInfo[i][c_x],aInfo[i][c_y],aInfo[i][c_z]);
    GetVehicleZAngle(vID,aInfo[i][c_r]);
    format(query, sizeof(query), "UPDATE Autos SET c_x='%f',c_y='%f',c_z='%f',c_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," "," ");
    SendClientMessage(playerid, hellgrün, "Du hast dein Auto geparkt.");
    return 1;
    }
    break;
    }
    }
    return SendClientMessage(playerid, hellgrün, "Du sitzt nicht in deinem Auto!");
    }




    Fehler:


    samplernen.p(895) : error 032: array index out of bounds (variable "aInfo")
    samplernen.p(943) : error 032: array index out of bounds (variable "aInfo")
    samplernen.p(951) : error 032: array index out of bounds (variable "aInfo")



    Es hängt aber auch noch mit:


    createPlayerCar(playerid,modelid,Float:x,Float:y,Float:z,Float:r)
    {
    for(new i=0; i<sizeof(aInfo); i++)
    {
    if(aInfo[i][id_x]!=0)continue;
    aInfo[i][besitzer]=sInfo[playerid][db_id];
    aInfo[i][c_x] =x;
    aInfo[i][c_y] =y;
    aInfo[i][c_z] =z;
    aInfo[i][c_r] =r;
    aInfo[i][model] =modelid;
    aInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,-1,-1,-1);
    new string[128];
    format(string,sizeof(string),"Das Auto aInfo[%i]wurde erstellt",i);
    SendClientMessageToAll(duneklhelblau,string);
    saveCarToDB(playerid,i);
    return 1;
    }
    return 1;
    }


    in verbindung also wird es glaub ich schwer die sache zu beheben



    public carSavedToDB(carid)
    {
    aInfo[carid][db_id]=cache_insert_id(dbhandle);
    return 1;
    }


    saveCarToDB(playerid,carid)
    {
    new query[128];
    format(query,sizeof(query),"INSERT INTO autos(besitzer,model,x,y,z,r) VALUES('%i','%i','%f','%f','%f','%f')",sInfo[playerid][db_id],aInfo[carid][model],aInfo[carid][c_x],aInfo[carid][c_y],aInfo[carid][c_z],aInfo[carid][c_r]);
    mysql_function_query(dbhandle,query,true,"carSavedToDB","i",carid);
    return 1;
    }

    ocmd:abschliessen(playerid,params[])
    {
    new Float:x,Float:y,Float:z;
    if(!IsPlayerInRangeOfPoint(playerid,3,x,y,z)
    new vID=GetPlayerVehicleID(playerid),
    motor,
    licht,
    alarm,
    tueren,
    bonnet,
    boot,
    objective;

    //abschliessen:
    GetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective);
    if(tueren==1){
    tueren = 0;
    }
    else
    {
    tueren = 1;
    }
    SetVehicleParamsEx(vID,motor,licht,alarm,tueren,bonnet,boot,objective);
    SendClientMessage(playerid,blau,"Du hast die Türen aufgeschlossen/abgeschlossen");
    new vID = INVALID_VEHICLE_ID;
    if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
    {
    new Float:Pos[3];
    for(new i=0;i<MAX_VEHICLES; i++)
    {
    GetVehiclePos(i, Pos[0], Pos[1], Pos[2]);
    if(IsPlayerInRangeOfPoint(playerid, 5.0, Pos[0], Pos[1], Pos[2]))
    {
    vID = i;
    break;
    }
    }
    }
    else if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    vID = GetPlayerVehicleID(playerid);
    }
    if(vID == INVALID_VEHICLE_ID) return SendClientMessage(playerid, 0xFF0000FF, "Error: Nicht nahe oder in einem Fahrzeug.");





    return 1;

    }

    Ich will es eigentlich so haben:



    Spieler loggt sich ein geht arbeiten und hat z.B. 100$ auf der Hand. Spieler geht zum BSN und kauft sich für 12$ etwas zum Essen. Spieler hat nun 88$ auf der Hand.


    Spieler loggt sich vom Server. Spieler wird gespeicher und alle werte werden auf null gesetzt.


    Spieler geht wieder auf den Server und loggt sich mit sein Spielernamen und Passwort ein. Spieler bekommt die werte aus der Datenbank zurück und hat nun seine 88$ auf der hand.