Beiträge von Blackshadowscript




    getFreeCarID()
    {
    for(new i=0; i<sizeof(AutoInfo); i++)
    {
    if(AutoInfo[i][Fahrzeugid] == 0)return i;
    }
    return 0;
    }
    loadplayercars(playerid)
    {
    new query[128];
    format(query,sizeof(query),"SELECT * FROM Autos WHERE Besitzer='%i' ",sInfo[playerid] [db_id]);
    mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i",playerid);
    return 1;
    }
    public OnPlayerCarsLoad(playerid)
    {
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(!num_rows)return 1;
    for(new i=0; i<num_rows; i++)
    {
    new id=getFreeCarID();
    AutoInfo[id] [model]=cache_get_field_content_int(i,"Besitzer",dbhandle);
    AutoInfo[id][Besitzer]=cache_get_field_content_int(i,"model",dbhandle);
    AutoInfo[id][c_x]=cache_get_field_content_float(i,"c_x",dbhandle);
    AutoInfo[id][c_y]=cache_get_field_content_float(i,"c_y",dbhandle);
    AutoInfo[id][c_z]=cache_get_field_content_float(i,"c_z",dbhandle);
    AutoInfo[id][c_r]=cache_get_field_content_float(i,"c_r",dbhandle);
    AutoInfo[id] [db_id]=cache_get_field_content_int(i,"id",dbhandle);
    AutoInfo[id][Fahrzeugid]=CreateVehicle(AutoInfo[id][model],AutoInfo[id][c_x],AutoInfo[id][c_y],AutoInfo[id][c_z],AutoInfo[id][c_r],-1,-1,-1);
    }
    return 1;
    }
    public OnPasswordResponse(playerid)
    {
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows==1) //Passwort richtig
    {
    sInfo[playerid][eingeloggt] = 1;
    SendClientMessage(playerid,helbau,"Du hast dich erfolgreich eingeloggt!");
    sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle);
    SetPlayerScore(playerid,sInfo[playerid][level]);
    sInfo[playerid][Adminlevel] = cache_get_field_content_int(0,"Adminlevel",dbhandle);
    SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle));
    sInfo[playerid] [db_id] = cache_get_field_content_int(0,"id",dbhandle);
    loadplayercars(playerid);

    }
    else //Passwort falsch
    {


    }
    return 1;
    }

    Mencent kannst du hiermit was anfangen?


    ----------------------------------
    [13:11:52] Blackshadowscript
    [13:11:52] ----------------------------------


    [13:11:52] Number of vehicle models: 0
    [13:11:52] num rows = 1
    [13:12:08] OnPlayerCarsLoad playerid: 0
    [13:12:08] rows: 2
    [13:12:13] [part] Blackshadow has left the server (0:1)
    [13:12:17] --- Server Shutting Down.
    [13:12:17] Der Server wurde beendet
    [13:12:17]


    [13:12:17] ===============================


    [13:12:17] sscanf plugin unloaded.


    [13:12:17] ===============================


    [13:12:17] plugin.mysql: Unloading plugin...
    [13:12:17] plugin.mysql: Plugin unloaded.



    lernen.p(640) : error 017: undefined symbol "i"
    lernen.p(641) : error 017: undefined symbol "i"
    lernen.p(642) : error 017: undefined symbol "i"
    lernen.p(643) : error 017: undefined symbol "i"
    lernen.p(644) : error 017: undefined symbol "i"
    lernen.p(645) : error 017: undefined symbol "i"
    lernen.p(646) : error 017: undefined symbol "i"

    Removebuildings kommen unter public OnPlayerConnect


    und das ist die einzige stelle wo man es rein machen kann includs würden dein system verbuggen und SetDynamicObjectMaterial gibt es soweit wie ich weis nicht mals

    Joker hier noch mal der ganze code der nach deiner Meinung gehen sollte:



    getFreeCarID()
    {
    for(new i=0; i<sizeof(AutoInfo); i++)
    {
    if(AutoInfo[i] [Fahrzeugid]==0)return i;

    }
    return 0;
    }
    public OnPlayerCarsLoad(playerid)
    {
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(!num_rows)return 1;
    for(new i=0; i<num_rows; i++)
    {
    new id=getFreeCarID();
    AutoInfo[id] [model]=cache_get_field_content_int(i,"Besitzer",dbhandle);
    AutoInfo[id][Besitzer]=cache_get_field_content_int(i,"model",dbhandle);
    AutoInfo[id][c_x]=cache_get_field_content_float(i,"c_x",dbhandle);
    AutoInfo[id][c_y]=cache_get_field_content_float(i,"c_y",dbhandle);
    AutoInfo[id][c_z]=cache_get_field_content_float(i,"c_z",dbhandle);
    AutoInfo[id][c_r]=cache_get_field_content_float(i,"c_r",dbhandle);
    AutoInfo[id] [db_id]=cache_get_field_content_int(i,"id",dbhandle);
    AutoInfo[id][Fahrzeugid]=CreateVehicle(AutoInfo[id][model],AutoInfo[id][c_x],AutoInfo[id][c_y],AutoInfo[id][c_z],AutoInfo[id][c_r],-1,-1,-1);
    }
    return 1;
    }
    loadplayercars(playerid)
    {
    new query[128];
    format(query,sizeof(query),"SELECT * FROM Autos WHERE Besitzer='%i' ",sInfo[playerid] [db_id]);
    mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i"playerid);
    return 1;
    }
    public OnPasswordResponse(playerid)
    {
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows==1) //Passwort richtig
    {
    sInfo[playerid][eingeloggt] = 1;
    SendClientMessage(playerid,helbau,"Du hast dich erfolgreich eingeloggt!");
    sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle);
    SetPlayerScore(playerid,sInfo[playerid][level]);
    sInfo[playerid][Adminlevel] = cache_get_field_content_int(0,"Adminlevel",dbhandle);
    SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle));
    sInfo[playerid] [db_id] = cache_get_field_content_int(0,"id",dbhandle);
    loadplayercars(playerid);

    }
    else //Passwort falsch
    {


    }
    return 1;
    }


    es geht einfach nicht

    getFreeCarID()
    {
    for(new i=0; i<sizeof(AutoInfo); i++)
    {
    if(AutoInfo[i] [Fahrzeugid]==0)return i;

    }
    return 0;
    }
    public OnPlayerCarsLoad(playerid)
    {
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(!num_rows)return 1;
    for(new i=0; i<num_rows; i++)
    {
    new id=getFreeCarID();
    AutoInfo[i] [model]=cache_get_field_content_int(i,"Besitzer",dbhandle);
    AutoInfo[i][Besitzer]=cache_get_field_content_int(i,"model",dbhandle);
    AutoInfo[i][c_x]=cache_get_field_content_float(i,"c_x",dbhandle);
    AutoInfo[i][c_y]=cache_get_field_content_float(i,"c_y",dbhandle);
    AutoInfo[i][c_z]=cache_get_field_content_float(i,"c_z",dbhandle);
    AutoInfo[i][c_r]=cache_get_field_content_float(i,"c_r",dbhandle);
    AutoInfo[id] [db_id]=cache_get_field_content_int(i,"id",dbhandle);
    AutoInfo[id][Fahrzeugid]=CreateVehicle(AutoInfo[i][model],AutoInfo[i][c_x],AutoInfo[i][c_y],AutoInfo[i][c_z],AutoInfo[i][c_r],-1,-1,-1);
    }
    return 1;
    }
    loadplayercars(playerid)
    {
    new query[128];
    format(query,sizeof(query),"SELECT * FROM Autos WHERE Besitzer='%i' ",sInfo[playerid] [db_id]);
    mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i"playerid);
    return 1;


    autos werden zwar in die db gespeichert aber werden nach server restart nicht aus der db geladen ich weiss leider auch nicht wo der fehler sein könnte

    Autos werden in der db abgespeichert aber nicht wieder ausgelesen.



    Mein Code:


    Enum:


    enum AutoSystemEnum{
    Fahrzeugid,
    Besitzer[MAX_PLAYER_NAME],
    model,
    Float:c_x,
    Float:c_y,
    Float:c_z,
    Float:c_r,
    db_id
    }
    new AutoInfo[50] [AutoSystemEnum];



    meine public auto:


    for(new i=0; i<=sizeof (AutoInfo); i++)
    {
    if(AutoInfo [i] [Fahrzeugid]==0)continue;
    if(AutoInfo[i] [Besitzer]!=sInfo[playerid] [db_id])continue;
    GetVehiclePos(AutoInfo[i][Fahrzeugid],AutoInfo[i][c_x],AutoInfo[i][c_y],AutoInfo[i][c_z]);
    GetVehicleZAngle(AutoInfo[i] [Fahrzeugid],AutoInfo[i][c_r]);
    new query[128];
    format(query,sizeof(query),"UPDATE Autos SET x='%f',y='%f',z='%f',r='%f' WHERE db_id='%i' ",AutoInfo[i] [c_x],AutoInfo[i] [c_y],AutoInfo[i] [c_z],AutoInfo[i] [c_r],AutoInfo[i] [db_id]);
    mysql_function_query(dbhandle,query,false," "," ");
    DestroyVehicle(AutoInfo[i] [Fahrzeugid]);
    AutoInfo[i] [Fahrzeugid]=0;
    break;

    }



    Auto erstellen/Auto löschen:


    ocmd:autosetzen(playerid,params[])


    {
    if(!isAdmin(playerid,8)) return SendClientMessage(playerid,helbau,"Du hast nicht die passende Rechte dafür!");
    new mID,pID;
    if(sscanf(params,"ui",pID,mID))return SendClientMessage(playerid,helbau,"Benutze: /autosetzen [playerid] [model]");
    if(mID<400||mID>611)return SendClientMessage(playerid,rot,"Ungültige Modelid!");
    new Float:X,Float:Y,Float:Z,Float:R;
    GetPlayerPos(pID,X,Y,Z);
    GetPlayerFacingAngle(pID,R);
    new string[128], string1[128];
    format(string, sizeof(string), "INSERT INTO Autos (Besitzer, model, x, y, z, r) VALUES ('%i', '%i', '%f', '%f', '%f', '%f')",pID,mID,X,Y,Z,R);
    format(string1, sizeof(string1), "Du hast erfolgreich das Auto mit der Model ID %d erstellt!", mID);
    SendClientMessage(playerid, grün, string1);
    CreateVehicle(mID, X, Y, Z, R, -1, -1, -1);
    mysql_function_query(dbhandle,string,false," "," ");
    return 1;
    }


    ocmd:autoentfernen(playerid,params[])
    {
    if(!isAdmin(playerid,8))return SendClientMessage(playerid,helbau,"Du hast nicht die passende Rechte dafür!");
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid,grün,"Sie befinden sich in kein Fahrzeug/Zug!");
    DestroyVehicle(GetPlayerVehicleID(playerid));
    return 1;
    }





    Die Abfrage fürs laden der Autos aus der DB:


    public OnPlayerCarsLoad(playerid)
    {
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(!num_rows)return 1;
    for(new i=0; i<num_rows; i++)
    {
    new id=getFreeCarID();
    AutoInfo[id] [model]=cache_get_field_content_int(i,"Besitzer",dbhandle);
    AutoInfo[id][Besitzer]=cache_get_field_content_int(i,"model",dbhandle);
    AutoInfo[id][c_x]=cache_get_field_content_float(i,"c_x",dbhandle);
    AutoInfo[id][c_y]=cache_get_field_content_float(i,"c_y",dbhandle);
    AutoInfo[id][c_z]=cache_get_field_content_float(i,"c_z",dbhandle);
    AutoInfo[id][c_r]=cache_get_field_content_float(i,"c_r",dbhandle);
    AutoInfo[id] [db_id]=cache_get_field_content_int(i,"id",dbhandle);
    AutoInfo[id][Fahrzeugid]=CreateVehicle(AutoInfo[id][model],AutoInfo[id][c_x],AutoInfo[id][c_y],AutoInfo[id][c_z],AutoInfo[id][c_r],-1,-1,-1);
    }
    return 1;
    }
    loadplayercars(playerid)
    {
    new query[128];
    format(query,sizeof(query),"SELECT * FROM Autos WHERE Besitzer='%i' ",sInfo[playerid] [db_id]);
    mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i"playerid);
    return 1;
    }



    public OnPasswordResponse(playerid)
    {
    new num_fields,num_rows;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(num_rows==1) //Passwort richtig
    {
    sInfo[playerid][eingeloggt] = 1;
    SendClientMessage(playerid,helbau,"Du hast dich erfolgreich eingeloggt!");
    sInfo[playerid][level] = cache_get_field_content_int(0,"level",dbhandle);
    SetPlayerScore(playerid,sInfo[playerid][level]);
    sInfo[playerid][Adminlevel] = cache_get_field_content_int(0,"Adminlevel",dbhandle);
    SetPlayerMoney(playerid,cache_get_field_content_int(0,"money",dbhandle));
    sInfo[playerid] [db_id] = cache_get_field_content_int(0,"id",dbhandle);
    loadplayercars(playerid);



    ich weiss leider nicht wo da der fehler ist wieso die in der db abgespeichert werden aber nicht wieder ausgelesen