Beiträge von reaL.

    ok hab das jetze aber es wird i-wie net gespeichert bei den Fcars


    public SaveAllFracVehs()
    {
    new query[256];
    for(new i=0; i<MAX_FRAC_VEHICLES; i++)
    {
    if(fcars[i][fc_modelID] >= 400 && fcars[i][fc_modelID] <= 611)
    {
    format(query, sizeof(query), "UPDATE FracVehicles SET ModelID = '%d', PosX = '%f', PosY = '%f', PosZ = '%f', PosA = '%f', Color1 = '%d', Color2 = '%d', FracID = '%d', Kennzeichen = '%d' WHERE ID = '%d'",
    fcars[i][fc_modelID], fcars[i][fc_x], fcars[i][fc_y], fcars[i][fc_z], fcars[i][fc_a], fcars[i][fc_color1], fcars[i][fc_color2], fcars[i][fc_fracID],fcars[i][e_plate], i);
    mysql_tquery(dbhandle, query);
    }
    }
    return 1;
    }


    LoadFrakVehicles()
    {
    mysql_tquery(dbhandle, "SELECT * FROM FracVehicles ORDER BY ID ASC", "LoadFracVehicles_Data");
    return 1;
    }


    public LoadFracVehicles_Data()
    {
    new rows, id, createdVehs;
    rows = cache_num_rows();
    for(new i=0; i<rows; i++)
    {
    id = cache_get_field_content_int(i, "ID");
    if(id < 0 || id >= MAX_FRAC_VEHICLES) continue;
    fcars[id][fc_modelID] = cache_get_field_content_int(i, "ModelID");
    fcars[id][fc_x] = cache_get_field_content_float(i, "PosX");
    fcars[id][fc_y] = cache_get_field_content_float(i, "PosY");
    fcars[id][fc_z] = cache_get_field_content_float(i, "PosZ");
    fcars[id][fc_a] = cache_get_field_content_float(i, "PosA");
    fcars[id][fc_color1] = cache_get_field_content_int(i, "Color1");
    fcars[id][fc_color2] = cache_get_field_content_int(i, "Color2");
    fcars[id][fc_fracID] = cache_get_field_content_int(i, "FracID");
    cache_get_field_content(i,"Kennzeichen",fcars[id][e_plate],dbhandle,10);
    if(fcars[id][fc_modelID] >= 400 && fcars[id][fc_modelID] <= 611)
    {
    fcars[id][fc_vID] = CreateVehicle(fcars[id][fc_modelID], fcars[id][fc_x], fcars[id][fc_y], fcars[id][fc_z], fcars[id][fc_a], fcars[id][fc_color1], fcars[id][fc_color2], -1);
    SetVehicleNumberPlate(fcars[i][fc_vID],fcars[i][e_plate]);
    }
    else
    {
    printf("[Error] Model-ID %d existiert nicht (ID: %d).", fcars[id][fc_modelID], id);
    }
    if(GetVehicleModel(MAX_VEHICLES-1) != 0) return print("Es können keine weiteren Fahrzeuge geladen werden, Limit (MAX_VEHICLES) erreicht.");
    createdVehs++;
    if(createdVehs == MAX_FRAC_VEHICLES) return print("Es können keine weiteren Fahrzeuge geladen werden, Limit (MAX_FRAC_VEHICLES) erreicht.");
    }
    return 1;
    }

    ich bekomme seit neusten dashier im Mysql.log
    [18:25:44] [ERROR] CMySQLQuery::Execute[] - (error #1146) Table 'samp.users' doesn't exist
    [18:25:44] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
    [18:25:44] [DEBUG] CMySQLQuery::Execute[] - starting query execution
    [18:25:44] [ERROR] CMySQLQuery::Execute[] - (error #1146) Table 'samp.users' doesn't exist

    wäre es nicht einfacher Mit MAX_VEHICLES zu Arbeiten eine Abfrage durch alle cars und abfragen ob es dort schon existiert und dann durch die Datenbank abzufragen ?


    dann bekomme ich Errors


    C:\Users\anette\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(11741) : error 033: array must be indexed (variable "cInfo")
    C:\Users\anette\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(11743) : error 017: undefined symbol "pvVehicle"
    C:\Users\anette\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(11743) : warning 215: expression has no effect
    C:\Users\anette\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(11743) : error 001: expected token: ";", but found "]"
    C:\Users\anette\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(11743) : error 029: invalid expression, assumed zero
    C:\Users\anette\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(11743) : fatal error 107: too many error messages on one line


    Jeffry:




    und wenn ich das hier mache dan spawnen nicht alle fcars
    public LoadFracVehicles_Data()
    {
    new rows, id, createdVehs;
    rows = cache_num_rows();
    for(new i=0; i<rows; i++)
    {
    id = cache_get_field_content_int(i, "ID");
    if(id < 0 || id >= MAX_FRAC_VEHICLES) continue;
    fcars[id][fc_modelID] = cache_get_field_content_int(i, "ModelID");
    fcars[id][fc_x] = cache_get_field_content_float(i, "PosX");
    fcars[id][fc_y] = cache_get_field_content_float(i, "PosY");
    fcars[id][fc_z] = cache_get_field_content_float(i, "PosZ");
    fcars[id][fc_a] = cache_get_field_content_float(i, "PosA");
    fcars[id][fc_color1] = cache_get_field_content_int(i, "Color1");
    fcars[id][fc_color2] = cache_get_field_content_int(i, "Color2");
    fcars[id][fc_fracID] = cache_get_field_content_int(i, "FracID");
    if(fcars[id][fc_modelID] >= 400 && fcars[id][fc_modelID] <= 611)
    {
    fcars[id][fc_vID] = CreateVehicle(fcars[id][fc_modelID], fcars[id][fc_x], fcars[id][fc_y], fcars[id][fc_z], fcars[id][fc_a], fcars[id][fc_color1], fcars[id][fc_color2], -1);
    /*new str[10],plate;
    plate = GetFreeNumberPlate();
    format(str, sizeof(str), "PRP-%d", plate);
    cInfo[i][ckz] = SetVehicleNumberPlate(cInfo[i][id_x],str);*/
    }
    else
    {
    printf("[Error] Model-ID %d existiert nicht (ID: %d).", fcars[id][fc_modelID], id);
    }
    if(GetVehicleModel(MAX_VEHICLES-1) != 0) return print("Es können keine weiteren Fahrzeuge geladen werden, Limit (MAX_VEHICLES) erreicht.");
    createdVehs++;
    if(createdVehs == MAX_FRAC_VEHICLES) return print("Es können keine weiteren Fahrzeuge geladen werden, Limit (MAX_FRAC_VEHICLES) erreicht.");
    }
    return 1;
    }

    so
    Jeffry:
    createPlayerCar(playerid,modelid,Float:x,Float:y,Float:z,Float:r)
    {
    for(new i=0; i<sizeof(cInfo); i++)
    {
    if(cInfo[i][id_x]!=0)continue;
    cInfo[i][besitzer]=sInfo[playerid][db_id];
    cInfo[i][c_x]=x;
    cInfo[i][c_y]=y;
    cInfo[i][c_z]=z;
    cInfo[i][c_r]=r;
    cInfo[i][model]=modelid;
    cInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,-1,-1,-1);
    tank[cInfo[i][id_x]] = 100;
    SetVehicleParamsEx(cInfo[i][id_x],0,0,0,1,0,0,0);
    saveCarToDB(playerid,i);
    new query[256];
    format(query,sizeof(query),"UPDATE autos SET Kennzeichen='%s' WHERE id='%i'",cInfo[i][ckz],cInfo[i][db_id]);
    mysql_function_query(dbhandle,query,false,"","");
    return 1;
    }
    return 1;
    }

    jetze kommt das


    [21:49:17] [ERROR] CMySQLQuery::Execute[carSavedToDB] - (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 ''5.3' at line 1

    sry fail xD


    public carSavedToDB(carid)
    {
    cInfo[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,tank,Kennzeichen) VALUES ('%i','%i','%f','%f','%f','%f','%i','%d')",sInfo[playerid][db_id],cInfo[carid][model],cInfo[carid][c_x],cInfo[carid][c_y],cInfo[carid][c_z],cInfo[carid][c_r],cInfo[carid][pctank],cInfo[carid][ckz]);
    mysql_function_query(dbhandle,query,true,"carSavedToDB","i",carid);
    return 1;
    }

    ich habe gerade ein Car gekauft und dann in der Datenbank gesehen das es nicht gespeichert wurde dann habe ich in der MySQL-log geschaut und da ist mir das aufgefallen


    [21:27:09] [ERROR] CMySQLQuery::Execute[carSavedToDB] - (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 ''270.327606' at line 1


    Jeffry:
    Kaliber:

    ich habe das jetze so aber den name wird nicht angezeigt ?
    es erscheint kurz und geht sofort wieder weg
    stock GetAutoBesitzer(playerid,vehicleid)
    {
    new string[50];
    for(new sv = 0; sv < sizeof(cInfo); sv++)
    {
    new name[30];
    format(name,sizeof(name),"SELECT name FROM users WHERE id = '%d'",string);
    }
    for(new i=0; i<MAX_FRAC_VEHICLES; i++)
    {
    if(fcars[i][fc_vID] == vehicleid)
    {
    if(fcars[i][fc_fracID] == 0)
    {
    format(string,sizeof(string),"Error");
    }
    else if(fcars[i][fc_fracID] == 1)
    {
    format(string,sizeof(string),"Polizei");
    }
    else if(fcars[i][fc_fracID] == 2)
    {
    format(string,sizeof(string),"FBI");


    }
    else if(fcars[i][fc_fracID] == 3)
    {
    format(string,sizeof(string),"Medic");


    }
    else if(fcars[i][fc_fracID] == 4)
    {
    format(string,sizeof(string),"Oamt");

    }
    else if(fcars[i][fc_fracID] == 5)
    {
    format(string,sizeof(string),"News");

    }
    else if(fcars[i][fc_fracID] == 6)
    {
    format(string,sizeof(string),"Fahrschule");

    }
    else if(fcars[i][fc_fracID] == 7)
    {
    format(string,sizeof(string),"Grove Street");

    }
    else if(fcars[i][fc_fracID] == 8)
    {
    format(string,sizeof(string),"Ballas");

    }
    else if(fcars[i][fc_fracID] == 9)
    {
    format(string,sizeof(string),"Vagos");

    }
    else if(fcars[i][fc_fracID] == 10)
    {
    format(string,sizeof(string),"Aztecas");

    }
    else if(fcars[i][fc_fracID] == 11)
    {
    format(string,sizeof(string),"S.F Rifa");

    }
    else if(fcars[i][fc_fracID] == 12)
    {
    format(string,sizeof(string),"Lacosa Nostra");

    }
    else if(fcars[i][fc_fracID] == 13)
    {
    format(string,sizeof(string),"Yakuza");

    }
    else if(fcars[i][fc_fracID] == 14)
    {
    format(string,sizeof(string),"Russen Mafia");

    }
    else if(fcars[i][fc_fracID] == 15)
    {
    format(string,sizeof(string),"Hitman");

    }
    else if(fcars[i][fc_fracID] == 16)
    {
    format(string,sizeof(string),"Wheelman");

    }
    }
    }
    for(new c=0; c<sizeof(Jobc); c++)
    {
    if(GetPlayerVehicleID(playerid) == Jobc[code=c][v_ID])
    {
    if(Jobc[code=c][Jobid] == 2)
    {
    format(string,sizeof(string),"Müllmann");
    convert_encoding(string);

    }
    else if(Jobc[code=c][Jobid] == 1)
    {
    format(string,sizeof(string),"Straßenreiniger");
    convert_encoding(string);

    }
    else if(Jobc[code=c][Jobid] == 3)
    {
    format(string,sizeof(string),"Pizzeria");

    }
    else if(Jobc[code=c][Jobid] == 4)
    {
    format(string,sizeof(string),"Postamt");

    }
    else if(Jobc[code=c][Jobid] == 5)
    {
    format(string,sizeof(string),"Bergarbeiter");

    }
    else if(Jobc[code=c][Jobid] == 6)
    {
    format(string,sizeof(string),"Holzfäller");
    convert_encoding(string);

    }
    }
    }
    for(new i = 0; i<sizeof(supmobil); i++)
    {
    if(GetPlayerVehicleID(playerid) == supmobil[i])
    {
    format(string,sizeof(string),"Supmobil");

    }
    }
    for(new i = 0; i<sizeof(newbie); i++)
    {
    if(GetPlayerVehicleID(playerid) == newbie[i])
    {
    format(string,sizeof(string),"Neuling");

    }
    }
    return string;
    }

    aber ich will ja eine Funktion die auch Prüft ob das Nummernschild schon bei den Privat Cars gibt und wenn ich ein Normales Car erstelle das ich die Funktion auch nutzen kann


    C:\Users\Tobi\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(5159) : warning 215: expression has no effect
    C:\Users\Tobi\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(5159) : error 001: expected token: ";", but found "]"
    C:\Users\Tobi\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(5159) : error 029: invalid expression, assumed zero
    C:\Users\Tobi\Desktop\Selfmade\Reallife Script v1.3.5\gamemodes\Reallifescript.pwn(5159) : fatal error 107: too many error messages on one line