Hilfe bei Autohaus System (Fehler/Bugs)

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
  • Hei,


    mein autohaus System geht bis zu dem Zeitpunkt wo ich ein fahrzeug kaufe.
    Es erscheint zwar am Spawnpoint wenn es gekauft ist. Aber man kann es nicht speichern (weil er keinen besitzer erkennt) und es spawnt nicht beim einloggen (Aber in MySQL wird auch kein besitzer aufgeführt und x,y,z,r daten sind alle auf 0)
    Insgesamt habe ich 6 Warning und diese sind in den code schnipseln mit kommentaren markiert


    Hier die code zeilen:


    Defines:


    #undef MAX_VEHICLES
    #define MAX_VEHICLES 800



    Car Enum:


    enum carEnum{
    id_x,
    model,
    besitzer,
    Float:c_x,
    Float:c_y,
    Float:c_z,
    Float:c_r,
    Color_1,
    Color_2,
    db_id,
    ci_tank
    }



    Autohaus SPAWN enum

    //Autohaus spawn
    enum autohausEnum{
    Float:s_x,
    Float:s_y,
    Float:s_z,
    Float:s_r
    }


    Autohaus CARS

    enum autohauscarEnum{
    model,
    Float:c_x,
    Float:c_y,
    Float:c_z,
    Float:c_r,
    c_preis,
    ah_id,
    Color_1,
    Color_2,
    c_name[50],
    c_tank,
    id_x
    }


    Variablen:

    new cInfo[2000][carEnum];//Soviele autos können auf dem server exestieren
    new autosOhneMotor[] = {481};


    Autohäuser:

    //Alle Autohäuser
    new ahInfo[][autohausEnum] = {
    {2126.6221,1428.9525,10.9484,89.5156}, //ID:0 Autohaus:1
    {2458.3274,1358.0619,10.5258,180.1502}, //ID:1 Autohaus:2
    {696.7387,1838.5415,5.1643,78.8214}, //ID:2 Autohaus:3
    {2449.0503,1629.2646,10.5256,359.8734}, //ID:3 Autohaus:4
    {1609.9999,1636.1665,10.5261,178.8637}, //ID:4 Autohaus:5
    {1592.3638,589.8622,-0.6224,203.4192} //ID:5 Autohaus:6
    };


    Position der Autos (mit name, preis, posi etc.)


    //Alle Autos der Autohäuser
    new ahCars[][autohauscarEnum] = {
    {412,2103.8450,1409.5842,10.6566,0.1924,15000,0,1,1,"Voodoo",40}, //Autohaus 1, Gebauchtwagen
    {534,2110.3457,1408.9539,10.5460,0.2380,15000,0,1,1,"Remington",40},
    {518,2116.8232,1408.8162,10.4937,358.3378,13000,0,1,1,"Buccaneer",518},
    {536,2123.1187,1409.0094,10.5498,1.4423,12500,0,1,1,"blade",40},
    {533,2129.6584,1408.5408,10.5294,359.8628,11000,0,1,1,"Feltzer",37},
    {466,2135.9221,1408.9258,10.5622,0.8526,8000,0,1,1,"Glendale",42},
    {492,2142.3069,1409.0468,10.5993,359.9930,17000,0,1,1,"Greenwood",42},
    {480,2148.8027,1408.4364,10.5927,359.4524,18500,0,1,1,"Comet",45},
    {603,2145.5586,1398.1621,10.6420,180.4652,16000,0,1,1,"Phoenix",47},
    {535,2139.1475,1398.2649,10.5756,178.6059,17500,0,1,1,"Slamvan",41},
    {562,2132.8357,1398.6896,10.4816,181.1042,15000,0,1,1,"Elegy",42},
    {558,2126.2896,1398.4696,10.4393,179.9395,14500,0,1,1,"Uranus",37},
    {507,2119.9333,1397.8513,10.6391,179.5709,6500,0,1,1,"Elegant",45},
    {600,2113.4722,1398.0952,10.5329,179.9730,8500,0,1,1,"Picador",38},
    {496,2107.1082,1398.6458,10.5840,179.4070,5500,0,1,1,"Blistra Compact",38},
    {565,2100.7520,1398.6073,10.4454,179.1954,4500,0,1,1,"Flash",36},
    {481,2461.9063,1337.8259,10.3210,151.2824,1500,1,1,1,"BMX",0}, //Autohaus2, Motorrad
    {462,2458.8877,1338.1765,10.4177,150.8521,3000,1,1,1,"Faggio",20},
    {586,2455.7124,1337.8788,10.3400,146.2616,13000,1,1,1,"Wayfarer",25},
    {581,2452.1418,1337.6221,10.4153,156.3525,18000,1,1,1,"BF-400",25},
    {521,2440.2124,1339.9473,10.3957,239.9504,24000,1,1,1,"FCR-900",25},
    {461,2440.2087,1342.6840,10.4038,243.7388,28000,1,1,1,"PCJ-600",25},
    {463,2440.2087,1345.8983,10.3606,242.9644,35000,1,1,1,"Freeway",30},
    {522,2440.1445,1348.8660,10.3921,239.4331,70000,1,1,1,"NRG-500",37},
    {468,683.3861,1825.2622,4.9573,328.4282,17000,2,1,1,"Sanchez",26}, //Autohaus3, Offroad
    {500,679.3278,1825.4117,5.3770,349.6652,25000,2,1,1,"Mesa",45},
    {554,674.8481,1827.3662,5.3320,348.9143,23000,2,1,1,"Yosemite",50},
    {505,668.3312,1829.7117,5.3198,302.6436,30000,2,1,1,"Rancher",52},
    {579,668.1749,1836.6044,5.0598,263.1929,24000,2,1,1,"Huntley",47},
    {400,668.4810,1841.7926,5.2596,263.3816,16500,2,1,1,"Landstalker",42},
    {471,668.0714,1845.3855,4.6346,260.6001,8000,2,1,1,"Quad",25},
    {409,2434.8821,1651.3101,10.6213,88.7507,150000,3,1,1,"Stretch",60}, //Autohaus4, LuxusCars
    {541,2426.1550,1653.9694,10.4452,219.8360,170000,3,1,1,"Bullet",55},
    {559,2422.8804,1662.0508,10.4766,332.8268,135000,3,1,1,"Jester",52},
    {506,2425.0513,1672.2029,10.5168,332.1645,120000,3,1,1,"Super GT",55},
    {402,2430.7961,1674.0610,10.6508,330.7833,110000,3,1,1,"Buffalo",47},
    {429,2435.2512,1673.7396,10.5004,1.3049,125000,3,1,1,"Banshee",45},
    {560,2439.7590,1673.7755,10.5256,26.5780,160000,3,1,1,"Sultan",57},
    {451,2446.1355,1672.6711,10.5247,27.7232,230000,3,1,1,"Turismo",62},
    {415,2447.3645,1662.3269,10.5932,203.3294,180000,3,1,1,"Cheetah",57},
    {411,2445.2241,1653.8003,10.5467,137.6222,250000,3,1,1,"Infernus",65},
    {519,1624.9279,1526.3020,11.7122,44.5704,400000,4,1,1,"Shamal",100}, //Autohaus5, Flugzeuge
    {469,1638.3878,1536.8196,10.8022,46.2593,320000,4,1,1,"Sparrow",75},
    {487,1648.4219,1542.1687,10.9241,42.4183,380000,4,1,1,"Maverick",70},
    {593,1657.7698,1549.4210,11.2489,41.6538,200000,4,1,1,"Dodo",60},
    {452,1616.3683,593.6839,-0.2332,164.5531,140000,5,1,1,"Speeder",60}, //Autohaus6, Boote
    {446,1617.1893,577.0570,-0.5587,166.4310,190000,5,1,1,"Squallo",55},
    {454,1639.6404,590.9737,0.2862,189.4858,250000,5,1,1,"Tropic",50},
    {473,1631.4811,572.1327,0.0651,185.6611,50000,5,1,1,"Dinghy",30},
    {493,1638.4229,576.5723,-0.1675,192.7350,200000,5,1,1,"Jetmax",60}
    };


    Bei OnGameModeInit:

    //Autohäuser laden
    for(new i=0; i<sizeof(ahCars); i++)
    {
    ahCars[i][id_x]=AddStaticVehicle(ahCars[i][model],ahCars[i][c_x],ahCars[i][c_y],ahCars[i][c_z],ahCars[i][c_r],1,1);
    }
    return 1;


    Bei OnPlayerDisconnect (das auto wird zerstört)



    public OnPlayerDisconnect(playerid, reason)
    {
    for(new i=0; i<sizeof(cInfo); i++)
    {
    if(cInfo[i][id_x]==0)continue;
    if(cInfo[i][besitzer]!=PlayerInfo[playerid][db_id])continue; // (706) : warning 213: tag mismatch
    /*GetVehiclePos(cInfo[i][id_x],cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z]);
    GetVehicleZAngle(cInfo[i][id_x],cInfo[i][c_r]);
    new query[128];
    format(query,sizeof(query),"UPDATE autos SET x='%f',y='%f',z='%f',r='%f' WHERE id='%i'",cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z],cInfo[i][c_r],cInfo[i][db_id]);
    mysql_pquery(dbhandle,query,"","");*/
    DestroyVehicle(cInfo[i][id_x]);
    cInfo[i][id_x]=0;
    }
    savePlayer(playerid);
    getPlayerLogged(playerid) = 0;
    return 1;
    }


    Auto in die Datenbank speichern

    forward carSavedToDB(carid);
    public carSavedToDB(carid)
    {
    cInfo[carid][db_id]=cache_insert_id();
    return 1;
    }


    OnPlayerStateChange:



    public OnPlayerStateChange(playerid, newstate, oldstate)
    {
    new vID=GetPlayerVehicleID(playerid);
    new vModel=GetVehicleModel(vID);


    for(new i=0; i<sizeof(autosOhneMotor); i++)
    {
    if(autosOhneMotor[i]!=vModel)continue;
    new tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    //Motor an/ausschalten
    GetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    SetVehicleParamsEx(vID, 1, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    }


    for(new i=0; i<sizeof(ahCars); i++)
    {
    if(ahCars[i][id_x]!=vID)continue;
    //Verkaufsprozess Notiz
    SetPVarInt(playerid,"buyCarID",i);
    new string[256];
    format(string,sizeof(string),"Name des Fahrzeugs: %s\nTank Kapazität: %i\nPreis des Fahrzeugs: %i$\nUm den kauf zu tätigen klicken sie auf Bestätigen",ahCars[i][c_name],ahCars[i][c_tank],ahCars[i][c_preis]);
    ShowPlayerDialog(playerid,DIALOG_AUTOHAUS,DIALOG_STYLE_MSGBOX,"Autohaus",string,"Bestätigen","Abbrechen");
    break;
    }


    new w = GetPlayerWeapon(playerid);
    if((newstate == PLAYER_STATE_PASSENGER || newstate == PLAYER_STATE_DRIVER) && w != 25 && w != 29 && w != 30 && w != 31)
    {
    SetPlayerArmedWeapon(playerid, 0);
    }
    return 1;
    }



    Bei Ondialog Response:


    case DIALOG_AUTOHAUS:
    {
    if(response)
    {
    //Autoverkauf notiz
    new id=GetPVarInt(playerid,"buyCarID"),query[265];
    if(getPlayerMoney(playerid)<ahCars[id][c_preis])
    {
    SendClientMessage(playerid,Rot,"Du besitzt nicht genügend Geld umd dieses Fahrzeug zu kaufen.");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    givePlayerMoney(playerid,-ahCars[id][c_preis]);
    format(query,sizeof(query),"INSERT INTO autos (besitzer,model,x,y,z,r,name,tank) VALUES ('%s','%i','%f','%f','%f','%f','%s','%f')",cInfo[id][besitzer],cInfo[id][model],cInfo[id][c_x],cInfo[id][c_y],cInfo[id][c_z],cInfo[id][c_r],cInfo[id][c_name],cInfo[id][ci_tank]); //warning 213: tag mismatch
    mysql_pquery(dbhandle,query,"carSavedToDB","i",id);
    createPlayerCar(playerid,ahCars[id][model],ahInfo[ahCars[id][ah_id]][s_x],ahInfo[ahCars[id][ah_id]][s_y],ahInfo[ahCars[id][ah_id]][s_z],ahInfo[ahCars[id][ah_id]][s_r]);
    SendClientMessage(playerid,Gruen,"Du hast das Fahrzeug erfolgreich gekauft");
    RemovePlayerFromVehicle(playerid);
    }
    else
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid,Rot,"Du hast den Kauf abgebrochen");
    }
    return 1;
    }



    OnPlayerCarsLoad:



    forward OnPlayerCarsLoad(playerid);
    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(); //warning 204: symbol is assigned a value that is never used: "id"
    cache_get_field_content(i,"besitzer",cInfo[i][besitzer],dbhandle,50);
    cInfo[i][model]=cache_get_field_content_int(i,"model",dbhandle);
    cInfo[i][c_x]=cache_get_field_content_float(i,"x",dbhandle);
    cInfo[i][c_y]=cache_get_field_content_float(i,"y",dbhandle);
    cInfo[i][c_z]=cache_get_field_content_float(i,"z",dbhandle);
    cInfo[i][c_r]=cache_get_field_content_float(i,"r",dbhandle);
    cInfo[i][db_id]=cache_get_field_content_int(i,"id",dbhandle);
    cInfo[i][ci_tank]=cache_get_field_content_int(i,"tank",dbhandle);
    cInfo[i][id_x]=CreateVehicle(cInfo[i][model],cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z],cInfo[i][c_r],-1,-1,-1);
    }
    return 1;
    }



    Eigene Befehle:


    ocmd:lock(playerid,params[])
    {
    if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER)return SendClientMessage(playerid,Rot,"Du musst der Fahrer eines Fahrzeugs sein um dein Auto auf/abzuschliessen");
    new vID=GetPlayerVehicleID(playerid),
    tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    //an/aufschliessen
    GetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    if(tmp_doors==1){
    tmp_doors =0;
    SendClientMessage(playerid, 0xF3CA00FF, "*Du hast dasFahrzeug abgeschlossen*");
    }else{
    tmp_doors = 1;
    SendClientMessage(playerid, 0xF3CA00FF, "*Du hast das Fahrzeug aufgeschlossen*");
    }
    SetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    return 1;
    }


    //Licht Auto an/aus
    ocmd:licht(playerid,params[])
    {
    if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER)return SendClientMessage(playerid,Rot,"Du musst der Fahrer eines Fahrzeugs sein um das Licht deines Autos an/aus zu machen");
    new vID=GetPlayerVehicleID(playerid),
    tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    //Licht an/ausschalten
    GetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    if(tmp_lights==1){
    tmp_lights =0;
    }else{
    tmp_lights = 1;
    }
    SetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    return 1;
    }


    //Motor anschalten
    ocmd:motor(playerid,params[])
    {
    if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER)return SendClientMessage(playerid,Rot,"Du musst der Fahrer eines Fahrzeugs sein um den Motor an/aus zu schalten");
    new vID=GetPlayerVehicleID(playerid),
    tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    new i;
    for(i = 0; i < sizeof(cInfo); i++) if(cInfo[i][id_x] == vID) break;
    if(i == sizeof(cInfo)) return SendClientMessage(playerid, Rot, "Dieses Fahrzeug kann man nicht tanken");
    if(cInfo[i][ci_tank]<1)return SendClientMessage(playerid, Rot, "Der Tank ist leer");
    //Motor an/ausschalten
    GetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    if(tmp_engine==1){
    tmp_engine =0;
    SendClientMessage(playerid, 0xF3CA00FF, "*Du schaltest den Motor aus*");
    }else{
    tmp_engine = 1;
    SendClientMessage(playerid, 0xF3CA00FF, "*Du schaltest den Motor an*");
    }
    SetVehicleParamsEx(vID, tmp_engine, tmp_lights, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    return 1;
    }


    ocmd:carradio(playerid, params[])
    {
    if(!IsPlayerInAnyVehicle(playerid))return SendClientMessage(playerid, Rot, "Du befindest dich in keinem Fahrzeug");
    new sitz;
    sitz = GetPlayerVehicleSeat(playerid);
    if(!sitz == 0)return SendClientMessage(playerid, Rot, "Du musst auf dem Fahrersitz sein!"); //warning 213: tag mismatch
    ShowPlayerDialog(playerid, DIALOG_CARRADIO, DIALOG_STYLE_TABLIST_HEADERS, "Radio Sender","Radiosender\tSubsender\tGenre\nTechno4Ever.FM\tMainstream\tTechno/Club\nRautemusik.FM\tDeutschrap Radio\tDeutschrap\nRautemusik.FM\tMain Radio\tMainstream\nRautemusik.FM\tWacken Radio\tMetal/Heavy Metal\n","Weiter", "Abbrechen");
    return 1;
    }


    //Fahrzeug Parken
    ocmd:parken(playerid,params[])
    {
    new Float:x,Float:y,Float:z,Float:r;
    if(!IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,Rot,"Du musst in deinem fahrzeug sitzen um es zu Parken");//abfrage ob er im wagen sitzt
    new vehid=GetPlayerVehicleID(playerid);
    new i;
    for(i = 0; i < sizeof(cInfo); i++) if(cInfo[i][id_x] == vehid) break;
    if(i == sizeof(cInfo)) return SendClientMessage(playerid, Rot, "Dieses Fahrzeug kann man nicht Parken");
    printf("Das Fahrzeug gehört der ID: %d, ich bin die ID: %d", cInfo[i][besitzer], PlayerInfo[playerid][db_id]); // warning 213: tag mismatch
    if(cInfo[i][besitzer]!=PlayerInfo[playerid][db_id])return SendClientMessage(playerid,Rot,"Dieser Wagen gehört nicht dir");//abfrage ob er der besitzer ist
    GetVehiclePos(vehid,x,y,z); // warning 213: tag mismatch
    GetVehicleZAngle(vehid,r);
    cInfo[i][c_x]=x;
    cInfo[i][c_y]=y;
    cInfo[i][c_z]=z;
    cInfo[i][c_r]=r;
    new query[128];
    format(query,sizeof(query),"UPDATE autos SET besitzer='%s',x='%f',y='%f',z='%f',r='%f' WHERE id='%i'",GetName(playerid),cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z],cInfo[i][c_r],cInfo[i][db_id]);
    mysql_pquery(dbhandle,query,"","");
    SendClientMessage(playerid,0xF3CA00FF,"Du dein Fahrzeug hier geparkt");
    return 1;
    }



    stocks:



    forward saveCarToDB(carid);
    stock saveCarToDB(carid)
    {
    new query[128];
    format(query,sizeof(query),"INSERT INTO autos (besitzer,model,x,y,z,r,name,tank) VALUES ('%s','%i','%f','%f','%f','%f','%s','%f')",cInfo[carid][besitzer],cInfo[carid][model],cInfo[carid][c_x],cInfo[carid][c_y],cInfo[carid][c_z],cInfo[carid][c_r],cInfo[carid][c_name],cInfo[carid][c_tank]);
    mysql_pquery(dbhandle,query,"carSavedToDB","i",carid);
    return 1;
    }


    stock 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;
    strmid(cInfo[i][besitzer],GetName(playerid),0,strlen(GetName(playerid)),24);
    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][Color_1]=1;
    cInfo[i][Color_2]=1;
    cInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,cInfo[i][Color_1],cInfo[i][Color_2],-1);
    cInfo[i][ci_tank] = 100;
    return 1;
    }
    return 1;
    }


    loadPlayerCars(playerid)
    {
    new query[128];
    format(query,sizeof(query),"SELECT * FROM autos WHERE besitzer='%s'",cInfo[playerid][besitzer]);
    mysql_function_query(dbhandle,query,true,"OnPlayerCarsLoad","i",playerid);
    return 1;
    }


    getFreeCarID()
    {
    for(new i=0; i<sizeof(cInfo); i++)
    {
    if(cInfo[i][id_x]==0)return i;
    }
    return 0;
    }


    isMotorOn(vID)
    {
    new tmp_engine, tmp_light, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective;
    GetVehicleParamsEx(vID, tmp_engine, tmp_light, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);


    if(tmp_engine == 1)return 1;
    return 0;
    }


    stopMotor(vID)
    {
    new tmp_engine, tmp_light, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective;
    GetVehicleParamsEx(vID, tmp_engine, tmp_light, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    SetVehicleParamsEx(vID, 0, tmp_light, tmp_alarm, tmp_doors, tmp_bonnet, tmp_boot, tmp_objective);
    return 1;
    }


    hatAutoMotor(vID)
    {
    new vModel = GetVehicleModel(vID);


    for(new i=0; i<sizeof(autosOhneMotor); i++)
    {
    if(autosOhneMotor[i]!=vModel)continue;
    return 0;
    }
    return 1;
    }


  • Setze beim Kauf das hier
    createPlayerCar(playerid,ahCars[id][model],ahInfo[ahCars[id][ah_id]][s_x],ahInfo[ahCars[id][ah_id]][s_y],ahInfo[ahCars[id][ah_id]][s_z],ahInfo[ahCars[id][ah_id]][s_r]);
    vor das Query, sprich zwei Zeilen drüber.


    Versuche es dann mal.

  • Setze beim Kauf das hier
    createPlayerCar(playerid,ahCars[id][model],ahInfo[ahCars[id][ah_id]][s_x],ahInfo[ahCars[id][ah_id]][s_y],ahInfo[ahCars[id][ah_id]][s_z],ahInfo[ahCars[id][ah_id]][s_r]);
    vor das Query, sprich zwei Zeilen drüber.


    Versuche es dann mal.

    Es hat sich nichts verändert. Vlt sollte man sich noch auf die anderen warnings beziehen

  • Versuche es vorerst mal so:
    stock 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;
    strmid(cInfo[i][besitzer],GetName(playerid),0,strlen(GetName(playerid)),24);
    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][Color_1]=1;
    cInfo[i][Color_2]=1;
    cInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,cInfo[i][Color_1],cInfo[i][Color_2],-1);
    cInfo[i][ci_tank] = 100;
    return i;
    }
    return i;
    }


    case DIALOG_AUTOHAUS:
    {
    if(response)
    {
    //Autoverkauf notiz
    new id=GetPVarInt(playerid,"buyCarID"),query[265];
    if(getPlayerMoney(playerid)<ahCars[id][c_preis])
    {
    SendClientMessage(playerid,Rot,"Du besitzt nicht genügend Geld umd dieses Fahrzeug zu kaufen.");
    RemovePlayerFromVehicle(playerid);
    return 1;
    }
    givePlayerMoney(playerid,-ahCars[id][c_preis]);
    new i = createPlayerCar(playerid,ahCars[id][model],ahInfo[ahCars[id][ah_id]][s_x],ahInfo[ahCars[id][ah_id]][s_y],ahInfo[ahCars[id][ah_id]][s_z],ahInfo[ahCars[id][ah_id]][s_r]);
    format(query,sizeof(query),"INSERT INTO autos (besitzer,model,x,y,z,r,name,tank) VALUES ('%s','%i','%f','%f','%f','%f','%s','%f')",cInfo[i][besitzer],cInfo[i][model],cInfo[i][c_x],cInfo[i][c_y],cInfo[i][c_z],cInfo[i][c_r],cInfo[i][c_name],cInfo[i][ci_tank]); //warning 213: tag mismatch
    mysql_pquery(dbhandle,query,"carSavedToDB","i",i);
    SendClientMessage(playerid,Gruen,"Du hast das Fahrzeug erfolgreich gekauft");
    RemovePlayerFromVehicle(playerid);
    }
    else
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid,Rot,"Du hast den Kauf abgebrochen");
    }
    return 1;
    }


    Lösche:
    new id=getFreeCarID(); //warning 204: symbol is assigned a value that is never used: "id"


    Und ändere
    if(!sitz == 0)return SendClientMessage(playerid, Rot, "Du musst auf dem Fahrersitz sein!"); //warning 213: tag mismatch
    zu
    if(sitz == 0)return SendClientMessage(playerid, Rot, "Du musst auf dem Fahrersitz sein!");


    Zwecks den Tag Mismatches:
    Prüfe jeweils, ob zu den Arrays der hintere Teil (in Klammern) im dazugehörigen enum steht, wenn nicht, füge ihn hinzu.

  • Habe jetzt noch einen Error und das ist dieser:


    error 017: undefined symbol "i"


    Das der Code


    stock 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;
    strmid(cInfo[i][besitzer],GetName(playerid),0,strlen(GetName(playerid)),24);
    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][Color_1]=1;
    cInfo[i][Color_2]=1;
    cInfo[i][id_x] = CreateVehicle(modelid,x,y,z,r,cInfo[i][Color_1],cInfo[i][Color_2],-1);
    cInfo[i][ci_tank] = 100;
    return i;
    }
    return i; //Fehlerzeile
    }


  • Oh ja, stimmt, mein Fehler, etwas zu eifrig ersetzt.


    Ändere es aber bitte zu
    return -1;


    Sonst kann das zu Fehlern führen, da dann, wenn ein Fahrzeug nicht erstellt werden konnte, das Fahrzeug mit dem Index 1 angesprochen würde, das wäre ja falsch.

  • Oh ja, stimmt, mein Fehler, etwas zu eifrig ersetzt.


    Ändere es aber bitte zu
    return -1;


    Sonst kann das zu Fehlern führen, da dann, wenn ein Fahrzeug nicht erstellt werden konnte, das Fahrzeug mit dem Index 1 angesprochen würde, das wäre ja falsch.

    Ok Super, habe jetzt meinen timer eingesetzt für den Tank (weil ich die warning los werden will)



    new tanktimer = 0;
    forward sekunde();
    public sekunde()
    {


    tanktimer++;
    if(tanktimer == 1)
    {
    tanktimer = 0;
    //Tanks reduzieren
    for(new i=1; i<sizeof(ci_tank); i++) //zeile 1621
    {
    if(!hatAutoMotor(i))continue;
    if(!isMotorOn(i))continue;
    ci_tank[i]--; //zeile 1625
    if(ci_tank[i]>0)continue;
    stopMotor(i);
    }
    }
    return 1;
    }



    und diese errors


    C:\Users\Spiele\Desktop\lvreallife.pwn(1621) : error 039: constant symbol has no size
    C:\Users\Spiele\Desktop\lvreallife.pwn(1625) : error 028: invalid subscript (not an array or too many subscripts): "ci_tank"
    C:\Users\Spiele\Desktop\lvreallife.pwn(1625) : warning 215: expression has no effect
    C:\Users\Spiele\Desktop\lvreallife.pwn(1625) : error 001: expected token: ";", but found "]"
    C:\Users\Spiele\Desktop\lvreallife.pwn(1625) : error 029: invalid expression, assumed zero
    C:\Users\Spiele\Desktop\lvreallife.pwn(1625) : fatal error 107: too many error messages on one line

  • Versuche es so:
    forward sekunde();
    public sekunde()
    {
    tanktimer++;
    if(tanktimer == 1)
    {
    tanktimer = 0;
    //Tanks reduzieren
    for(new i=0; i<sizeof(cInfo); i++)
    {
    if(!hatAutoMotor(i)) continue;
    if(!isMotorOn(i)) continue;
    cInfo[i][ci_tank]--;
    if(cInfo[i][ci_tank] > 0) continue;
    stopMotor(i);
    }
    }
    return 1;
    }