Car Load Paintjob Fehler

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
  • Hallo liebe community,


    ich habe folgendes problem und zwar wird beim laden des wagen andauernd der Paintjob überschrieben
    hier mal der PAWN-Code:



    public OnCarsLoad()
    {
    new num_rows, num_fields;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(!num_rows)return print("keine Autos");
    for(new i=0; i<num_rows; i++)
    {
    new vID = getFreeCarID();
    vInfo[vID][v_db_id]= cache_get_field_content_int(i,"id",dbhandle);
    vInfo[vID][v_nummer]=cache_get_field_content_int(i,"nummer",dbhandle);
    vInfo[vID][v_vehicle_id]= cache_get_field_content_int(i,"vehicleid",dbhandle);
    vInfo[vID][v_x]= cache_get_field_content_float(i,"x",dbhandle);
    vInfo[vID][v_y]= cache_get_field_content_float(i,"y",dbhandle);
    vInfo[vID][v_z]= cache_get_field_content_float(i,"z",dbhandle);
    vInfo[vID][v_r]= cache_get_field_content_float(i,"r",dbhandle);
    vInfo[vID][v_paintjob]=cache_get_field_content_int(i,"paintjob",dbhandle);
    vInfo[vID][v_Color1]= cache_get_field_content_int(i,"Color1",dbhandle);
    vInfo[vID][v_Color2]= cache_get_field_content_int(i,"Color2",dbhandle);
    vInfo[vID][v_fraktion]= cache_get_field_content_int(i,"fraktion",dbhandle);
    if(vInfo[vID][v_paintjob]==10)
    {
    vInfo[vID][v_id_x]= CreateVehicle(vInfo[vID][v_vehicle_id],vInfo[vID][v_x],vInfo[vID][v_y],vInfo[vID][v_z],vInfo[vID][v_r],vInfo[vID][v_Color1],vInfo[vID][v_Color2],0);
    }
    else
    {
    vInfo[vID][v_id_x]= CreateVehicle(vInfo[vID][v_vehicle_id],vInfo[vID][v_x],vInfo[vID][v_y],vInfo[vID][v_z],vInfo[vID][v_r],vInfo[vID][v_Color1],vInfo[vID][v_Color2],0);
    ChangeVehiclePaintjob(vInfo[vID][v_id_x],vInfo[vID][v_paintjob]);
    }
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Spoiler",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Hood",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Roof",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Sideskirt",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Lamps",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Nitro",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Exhaust",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Wheels",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Stereo",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Hydraulics",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Front_Bumper",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Rear_Bumper",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Vent_Left",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Vent_Right",dbhandle));
    printf("Auto Type: %i, ID: %i geladen...",vInfo[vID][v_vehicle_id],vID);
    }
    print("Alle autos geladen!");
    return 1;
    }

  • if(vInfo[vID][v_paintjob]==10)
    {
    vInfo[vID][v_id_x]= CreateVehicle(vInfo[vID][v_vehicle_id],vInfo[vID][v_x],vInfo[vID][v_y],vInfo[vID][v_z],vInfo[vID][v_r],vInfo[vID][v_Color1],vInfo[vID][v_Color2],0);
    }
    else
    {
    vInfo[vID][v_id_x]= CreateVehicle(vInfo[vID][v_vehicle_id],vInfo[vID][v_x],vInfo[vID][v_y],vInfo[vID][v_z],vInfo[vID][v_r],vInfo[vID][v_Color1],vInfo[vID][v_Color2],0);
    ChangeVehiclePaintjob(vInfo[vID][v_id_x],vInfo[vID][v_paintjob]);
    }


    zu


    vInfo[vID][v_id_x]= CreateVehicle(vInfo[vID][v_vehicle_id],vInfo[vID][v_x],vInfo[vID][v_y],vInfo[vID][v_z],vInfo[vID][v_r],vInfo[vID][v_Color1],vInfo[vID][v_Color2],0);
    ChangeVehiclePaintjob(vInfo[vID][v_id_x],vInfo[vID][v_paintjob]);


    Lass den Paintjob ganz normal auslesen, gibt ja immer nur 3. (0,1,2)


    mfg :thumbup:

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Als Tipp für dich falls die Funktion in deiner Version vorhanden ist.


    Du kannst statt
    new num_rows, num_fields;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(!num_rows)return print("keine Autos");
    for(new i=0; i<num_rows; i++)
    das hier schreiben


    if(!cache_get_row_count(dbhandle))return print("keine Autos");
    for(new i=0; i<cache_get_row_count(dbhandle); i++)


    Zitat

    ohh okay danke


    Gerne.


    mfg :thumbup:


  • public OnCarsLoad()
    {
    new num_rows, num_fields;
    cache_get_data(num_rows,num_fields,dbhandle);
    if(!cache_get_row_count(dbhandle))return print("keine Autos");
    for(new i=0; i<cache_get_row_count(dbhandle); i++)
    {
    new vID = getFreeCarID();
    vInfo[vID][v_db_id]= cache_get_field_content_int(i,"id",dbhandle);
    vInfo[vID][v_nummer]=cache_get_field_content_int(i,"nummer",dbhandle);
    vInfo[vID][v_vehicle_id]= cache_get_field_content_int(i,"vehicleid",dbhandle);
    vInfo[vID][v_x]= cache_get_field_content_float(i,"x",dbhandle);
    vInfo[vID][v_y]= cache_get_field_content_float(i,"y",dbhandle);
    vInfo[vID][v_z]= cache_get_field_content_float(i,"z",dbhandle);
    vInfo[vID][v_r]= cache_get_field_content_float(i,"r",dbhandle);
    vInfo[vID][v_paintjob]=cache_get_field_content_int(i,"paintjob",dbhandle);
    vInfo[vID][v_Color1]= cache_get_field_content_int(i,"Color1",dbhandle);
    vInfo[vID][v_Color2]= cache_get_field_content_int(i,"Color2",dbhandle);
    vInfo[vID][v_fraktion]= cache_get_field_content_int(i,"fraktion",dbhandle);
    vInfo[vID][v_id_x]= CreateVehicle(vInfo[vID][v_vehicle_id],vInfo[vID][v_x],vInfo[vID][v_y],vInfo[vID][v_z],vInfo[vID][v_r],vInfo[vID][v_Color1],vInfo[vID][v_Color2],0);
    ChangeVehiclePaintjob(vInfo[vID][v_id_x],vInfo[vID][v_paintjob]);
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Spoiler",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Hood",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Roof",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Sideskirt",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Lamps",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Nitro",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Exhaust",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Wheels",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Stereo",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Hydraulics",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Front_Bumper",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Rear_Bumper",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Vent_Left",dbhandle));
    AddVehicleComponent(vInfo[vID][v_id_x],cache_get_field_content_int(i,"Vent_Right",dbhandle));
    printf("Auto Type: %i, ID: %i geladen...",vInfo[vID][v_vehicle_id],vID);
    }
    print("Alle autos geladen!");
    return 1;
    }

  • Debugge das ganze mal..


    new VehicleNames[212][] = { // Weiter oben im Script
    {"Landstalker"},{"Bravura"},{"Buffalo"},{"Linerunner"},{"Perrenial"},{"Sentinel"},{"Dumper"},
    {"Firetruck"},{"Trashmaster"},{"Stretch"},{"Manana"},{"Infernus"},{"Voodoo"},{"Pony"},{"Mule"},
    {"Cheetah"},{"Ambulance"},{"Leviathan"},{"Moonbeam"},{"Esperanto"},{"Taxi"},{"Washington"},
    {"Bobcat"},{"Mr Whoopee"},{"BF Injection"},{"Hunter"},{"Premier"},{"Enforcer"},{"Securicar"},
    {"Banshee"},{"Predator"},{"Bus"},{"Rhino"},{"Barracks"},{"Hotknife"},{"Trailer 1"},{"Previon"},
    {"Coach"},{"Cabbie"},{"Stallion"},{"Rumpo"},{"RC Bandit"},{"Romero"},{"Packer"},{"Monster"},
    {"Admiral"},{"Squalo"},{"Seasparrow"},{"Pizzaboy"},{"Tram"},{"Trailer 2"},{"Turismo"},
    {"Speeder"},{"Reefer"},{"Tropic"},{"Flatbed"},{"Yankee"},{"Caddy"},{"Solair"},{"Berkley's RC Van"},
    {"Skimmer"},{"PCJ-600"},{"Faggio"},{"Freeway"},{"RC Baron"},{"RC Raider"},{"Glendale"},{"Oceanic"},
    {"Sanchez"},{"Sparrow"},{"Patriot"},{"Quad"},{"Coastguard"},{"Dinghy"},{"Hermes"},{"Sabre"},
    {"Rustler"},{"ZR-350"},{"Walton"},{"Regina"},{"Comet"},{"BMX"},{"Burrito"},{"Camper"},{"Marquis"},
    {"Baggage"},{"Dozer"},{"Maverick"},{"News Chopper"},{"Rancher"},{"FBI Rancher"},{"Virgo"},{"Greenwood"},
    {"Jetmax"},{"Hotring"},{"Sandking"},{"Blista Compact"},{"Police Maverick"},{"Boxville"},{"Benson"},
    {"Mesa"},{"RC Goblin"},{"Hotring Racer A"},{"Hotring Racer B"},{"Bloodring Banger"},{"Rancher"},
    {"Super GT"},{"Elegant"},{"Journey"},{"Bike"},{"Mountain Bike"},{"Beagle"},{"Cropdust"},{"Stunt"},
    {"Tanker"}, {"Roadtrain"},{"Nebula"},{"Majestic"},{"Buccaneer"},{"Shamal"},{"Hydra"},{"FCR-900"},
    {"NRG-500"},{"HPV1000"},{"Cement Truck"},{"Tow Truck"},{"Fortune"},{"Cadrona"},{"FBI Truck"},
    {"Willard"},{"Forklift"},{"Tractor"},{"Combine"},{"Feltzer"},{"Remington"},{"Slamvan"},
    {"Blade"},{"Freight"},{"Streak"},{"Vortex"},{"Vincent"},{"Bullet"},{"Clover"},{"Sadler"},
    {"Firetruck LA"},{"Hustler"},{"Intruder"},{"Primo"},{"Cargobob"},{"Tampa"},{"Sunrise"},{"Merit"},
    {"Utility"},{"Nevada"},{"Yosemite"},{"Windsor"},{"Monster A"},{"Monster B"},{"Uranus"},{"Jester"},
    {"Sultan"},{"Stratum"},{"Elegy"},{"Raindance"},{"RC Tiger"},{"Flash"},{"Tahoma"},{"Savanna"},
    {"Bandito"},{"Freight Flat"},{"Streak Carriage"},{"Kart"},{"Mower"},{"Duneride"},{"Sweeper"},
    {"Broadway"},{"Tornado"},{"AT-400"},{"DFT-30"},{"Huntley"},{"Stafford"},{"BF-400"},{"Newsvan"},
    {"Tug"},{"Trailer 3"},{"Emperor"},{"Wayfarer"},{"Euros"},{"Hotdog"},{"Club"},{"Freight Carriage"},
    {"Trailer 3"},{"Andromada"},{"Dodo"},{"RC Cam"},{"Launch"},{"Police Car (LSPD)"},{"Police Car (SFPD)"},
    {"Police Car (LVPD)"},{"Police Ranger"},{"Picador"},{"S.W.A.T. Van"},{"Alpha"},{"Phoenix"},{"Glendale"},
    {"Sadler"},{"Luggage Trailer A"},{"Luggage Trailer B"},{"Stair Trailer"},{"Boxville"},{"Farm Plow"},
    {"Utility Trailer"}
    };


    #define getVehicleName(%0) VehicleNames[%0-400] //Unter dem Array "VehicleNames"


    printf("%s | %i", getVehicleName(vInfo[vID][v_vehicle_id]), vInfo[vID][v_paintjob]); //In OnCarsLoad


    mfg :thumbup:


  • stock getFreeCarID()
    {
    for(new i=0; i<sizeof(vInfo); i++)
    {
    if(vInfo[i][v_id_x]==0)return i;
    }
    return 1;
    }



    enum VehicleDaten{
    v_db_id,
    v_paintjob,
    v_id_x[MAX_VEHICLES],
    v_vehicle_id,
    Float:v_x,
    Float:v_y,
    Float:v_z,
    Float:v_r,
    v_Color1,
    v_Color2,
    v_fraktion,
    v_nummer,
    v_spoiler,
    v_hood,
    v_roof,
    v_sideskirt,
    v_lamps,
    v_nitro,
    v_exhaust,
    v_wheels,
    v_stereo,
    v_hydraulics,
    v_front_bumper,
    v_rear_bumper,
    v_vent_left,
    v_vent_right
    }



    new vInfo[MAX_VEHICLES][VehicleDaten];