Fraktionswagen für gTeam funktionieren nicht.

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
  • Also ich habe folgendes Problem.


    Ich habe mit gTeam Fraktionen erstellt. Klappt alles prima.
    Dann habe ich Fraktionswagen für die einzelnen Fraktionen erstellt.
    Ich bekomem auch keine Error's aber es funktioniert trotzdem nicht.


    Wenn ich nun z.b. Taxifahrer bin und versuche in ein Medic Car einzusteigen steht dort immer "Du bist kein Polizist!" obwohl ich einen anderen Text hingeschrieben habe. Wenn ich Medic bin und in mein Medic Car einsteigen will kommt da ne andere Meldung wie z.b. "Du bist kein Taxifahrer!" und ich kann nicht einsteigen.


    Hier mal der Code:


    Ganz oben:
    new Taxi1;
    new Taxi2;
    new Taxi3;
    new FSPKW1;
    new FSPKW2;
    new FSPKW3;
    new FSLKW1;
    new FSLKW2;
    new FSLKW3;
    new FSRoller1;
    new FSRoller2;
    new FSRoller3;
    new FSBike1;
    new FSBike2;
    new FSBike3;
    new FSBoot1;
    new FSBoot2;
    new FSHeli1;
    new Copcar1;
    new Copcar2;
    new Copcar3;
    new Copbike1;
    new Copbike2;
    new Copbike3;
    new EQMC1;
    new EQMC2;


    Bei OnGameModeInit:
    ////////////////////////////////////////////////////////////////////////////////
    //Fahrschulwagen////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    FSPKW1 = AddStaticVehicle(516,-2251.6521,2285.0317,4.6540,90.1639,36,1); // PKW1
    FSPKW2 = AddStaticVehicle(516,-2251.6160,2288.0554,4.6502,89.9292,36,1); // PKW2
    FSPKW3 = AddStaticVehicle(516,-2251.6465,2291.0405,4.6503,90.2437,36,1); // PKW3
    FSLKW1 = AddStaticVehicle(514,-2253.6245,2293.9890,5.4013,89.7516,113,1); // LKW1
    FSLKW2 = AddStaticVehicle(514,-2253.4761,2297.1777,5.4034,89.7526,113,1); // LKW2
    FSLKW3 = AddStaticVehicle(514,-2253.4563,2300.0457,5.3999,89.6460,113,1); // LKW3
    FSRoller1 = AddStaticVehicle(462,-2271.3647,2285.3994,4.4192,269.0682,2,1); // Roller1
    FSRoller2 = AddStaticVehicle(462,-2271.5513,2288.3354,4.4197,269.4862,2,1); // Roller2
    FSRoller3 = AddStaticVehicle(462,-2271.5115,2291.4727,4.4190,269.6465,2,1); // Roller3
    FSBike1 = AddStaticVehicle(461,-2271.6497,2294.3875,4.4072,271.1942,75,1); // Motorad1
    FSBike2 = AddStaticVehicle(461,-2271.2249,2297.4714,4.4048,269.0480,75,1); // Motorad2
    FSBike3 = AddStaticVehicle(461,-2271.5164,2300.5442,4.4105,269.2317,75,1); // Motorad3
    FSBoot1 = AddStaticVehicle(446,-2221.4915,2398.5085,-0.4902,44.7134,1,22); // Boot1
    FSBoot2 = AddStaticVehicle(484,-2230.9268,2390.5339,0.2024,44.8344,50,32); // Boot2
    FSHeli1 = AddStaticVehicle(417,-2227.6128,2327.5447,7.6344,0.3942,0,0); // Heli1
    ////////////////////////////////////////////////////////////////////////////////
    //EQPD Wagen////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    Copcar1 = AddStaticVehicle(598,-1400.1123,2659.5911,55.4331,89.7256,0,1); // EQPD Wagen 1
    Copcar2 = AddStaticVehicle(598,-1400.2815,2656.5476,55.4331,89.8117,0,1); // EQPD Wagen 2
    Copcar3 = AddStaticVehicle(598,-1399.8925,2653.4155,55.4325,89.5814,0,1); // EQPD Wagen 3
    Copbike1 = AddStaticVehicle(523,-1400.3812,2628.5920,55.3404,91.3905,0,0); // EQPD Bike 1
    Copbike2 = AddStaticVehicle(523,-1400.1453,2631.5649,55.3349,89.9631,0,0); // EQPD Bike 2
    Copbike3 = AddStaticVehicle(523,-1400.0974,2634.5459,55.2910,87.5339,0,0); // EQPD Bike 3
    ////////////////////////////////////////////////////////////////////////////////
    //EQMC Wagen////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    EQMC1 = AddStaticVehicle(416,-1528.4407,2525.3193,55.9232,0.1558,1,3); // EQMC Wagen 1
    EQMC2 = AddStaticVehicle(416,-1519.5109,2525.8672,55.8411,359.8345,1,3); // EQMC Wagen 2
    ////////////////////////////////////////////////////////////////////////////////
    //Taxi Wagen////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    Taxi1 = AddStaticVehicle(438,-2440.8074,2223.8562,4.8468,359.9324,6,76); // Taxi Wagen 1
    Taxi2 = AddStaticVehicle(438,-2443.8347,2223.9121,4.8475,0.3498,6,76); // Taxi Wagen 2
    Taxi3 = AddStaticVehicle(438,-2446.7866,2223.8889,4.8471,359.6656,6,76); // Taxi Wagen 3


    Bei OnPlayerEnterVehicle:
    if(Taxi1 || Taxi2 ||Taxi3)
    {
    if(Team[playerid] == Taxi)
    {
    }
    else
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Taxifahrer!");
    return 1;
    }
    }
    ////////////////////////////////////////////////////////////////////////////////
    if(Copcar1 || Copcar2 || Copcar3 || Copbike1 || Copbike2 || Copbike3)
    {
    if(Team[playerid] == EQPD)
    {
    }
    else
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Polizist!");
    return 1;
    }
    }
    ////////////////////////////////////////////////////////////////////////////////
    if(EQMC1 || EQMC2)
    {
    if(Team[playerid] == EQMC)
    {
    }
    else
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Arzt!");
    return 1;
    }
    }
    ////////////////////////////////////////////////////////////////////////////////
    if(FSPKW1 || FSPKW2 || FSPKW3 || FSLKW1 || FSLKW2 || FSLKW3 || FSRoller1 || FSRoller2 || FSRoller3 || FSBike1 || FSBike2 || FSBike3 || FSBoot1 || FSBoot2 || FSHeli1)
    {
    if(Team[playerid] == Fahrschule)
    {
    }
    else
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Fahrlehrer!");
    return 1;
    }
    }


    Achja gTeam heißt bei mir Team habs umbenannt weil mich der vorderbuchstabe nervte. :)
    Ich hoffe mir kann jemand helfen.


    Danke im Vorraus.

  • zum ersten empfehle ich Arrays zu benutzen.
    zum zweiten versuchst ambesten deine gespeicherten variablen mit irgendwas abzugleichen:
    if (vehicleid == Taxi1 || ...


    zum dritten:
    Viel erfolg ^^


    // Edit: Noch n kleiner Tipp. Setze deine Fraktions Cars alle in eine Funktion:
    forward TaxiCars(verhicleid);


    public TaxiCars(vehicleid)
    {
    for(new i=0; i<MAX_VEHICLES;i++)
    {
    if(vehicleid==Taxi[i])//Sofern du Arrays benutzt
    {
    return 1;
    }
    }
    }


    MfG
    Blank

    Du auch?

    Einmal editiert, zuletzt von Bl4nk.C0de ()

  • Hab das mal Komplett überarbeitet,es funzt,hoffe war dir recht :)

    //Weil 15 erstellt sind(0 zählt mit)
    #define MAX_FS_CARS 15
    #define MAX_COP_CARS 6
    #define MAX_MEDIC_CARS 2
    #define MAX_TAXI_CARS 3
    //brauchst hier nichtmehr die zahl reinschreiben musst nur die bei define ändern
    new FSCar[MAX_FS_CARS];
    new CopCar[MAX_COP_CARS];
    new MedicCar[MAX_MEDIC_CARS];
    new TaxiCar[MAX_TAXI_CARS];
    //-------------------------------
    ////////////////////////////////////////////////////////////////////////////////
    //Fahrschulwagen////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    FSCar[0] = AddStaticVehicle(516,-2251.6521,2285.0317,4.6540,90.1639,36,1); // PKW1
    FSCar[1] = AddStaticVehicle(516,-2251.6160,2288.0554,4.6502,89.9292,36,1); // PKW2
    FSCar[2] = AddStaticVehicle(516,-2251.6465,2291.0405,4.6503,90.2437,36,1); // PKW3
    FSCar[3] = AddStaticVehicle(514,-2253.6245,2293.9890,5.4013,89.7516,113,1); // LKW1
    FSCar[4] = AddStaticVehicle(514,-2253.4761,2297.1777,5.4034,89.7526,113,1); // LKW2
    FSCar[5] = AddStaticVehicle(514,-2253.4563,2300.0457,5.3999,89.6460,113,1); // LKW3
    FSCar[6] = AddStaticVehicle(462,-2271.3647,2285.3994,4.4192,269.0682,2,1); // Roller1
    FSCar[7] = AddStaticVehicle(462,-2271.5513,2288.3354,4.4197,269.4862,2,1); // Roller2
    FSCar[8] = AddStaticVehicle(462,-2271.5115,2291.4727,4.4190,269.6465,2,1); // Roller3
    FSCar[9] = AddStaticVehicle(461,-2271.6497,2294.3875,4.4072,271.1942,75,1); // Motorad1
    FSCar[10] = AddStaticVehicle(461,-2271.2249,2297.4714,4.4048,269.0480,75,1); // Motorad2
    FSCar[11] = AddStaticVehicle(461,-2271.5164,2300.5442,4.4105,269.2317,75,1); // Motorad3
    FSCar[12] = AddStaticVehicle(446,-2221.4915,2398.5085,-0.4902,44.7134,1,22); // Boot1
    FSCar[13] = AddStaticVehicle(484,-2230.9268,2390.5339,0.2024,44.8344,50,32); // Boot2
    FSCar[14] = AddStaticVehicle(417,-2227.6128,2327.5447,7.6344,0.3942,0,0); // Heli1
    ////////////////////////////////////////////////////////////////////////////////
    //EQPD Wagen////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    CopCar[0] = AddStaticVehicle(598,-1400.1123,2659.5911,55.4331,89.7256,0,1); // EQPD Wagen 1
    CopCar[1] = AddStaticVehicle(598,-1400.2815,2656.5476,55.4331,89.8117,0,1); // EQPD Wagen 2
    CopCar[2] = AddStaticVehicle(598,-1399.8925,2653.4155,55.4325,89.5814,0,1); // EQPD Wagen 3
    CopCar[3] = AddStaticVehicle(523,-1400.3812,2628.5920,55.3404,91.3905,0,0); // EQPD Bike 1
    CopCar[4] = AddStaticVehicle(523,-1400.1453,2631.5649,55.3349,89.9631,0,0); // EQPD Bike 2
    CopCar[5] = AddStaticVehicle(523,-1400.0974,2634.5459,55.2910,87.5339,0,0); // EQPD Bike 3
    ////////////////////////////////////////////////////////////////////////////////
    //EQMC Wagen////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    MedicCar[0] = AddStaticVehicle(416,-1528.4407,2525.3193,55.9232,0.1558,1,3); // EQMC Wagen 1
    MedicCar[1] = AddStaticVehicle(416,-1519.5109,2525.8672,55.8411,359.8345,1,3); // EQMC Wagen 2
    ////////////////////////////////////////////////////////////////////////////////
    //Taxi Wagen////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////
    TaxiCar[0] = AddStaticVehicle(438,-2440.8074,2223.8562,4.8468,359.9324,6,76); // Taxi Wagen 1
    TaxiCar[1] = AddStaticVehicle(438,-2443.8347,2223.9121,4.8475,0.3498,6,76); // Taxi Wagen 2
    TaxiCar[2] = AddStaticVehicle(438,-2446.7866,2223.8889,4.8471,359.6656,6,76); // Taxi Wagen 3
    //--------------------------------------------------
    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    for(new c=0;c<MAX_FS_CARS;c++)
    if(vehicleid == FSCar[code=c])
    {
    if(Team[playerid] != Fahrschule)
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Fahrlehrer!");
    return 1;
    }
    }
    ////////////////////////////////////////////////////////////////////////////////
    for(new c=0;c<MAX_COP_CARS;c++)
    if(vehicleid == CopCar[code=c])
    {
    if(Team[playerid] != EQPD)
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Polizist!");
    return 1;
    }
    }
    ////////////////////////////////////////////////////////////////////////////////
    for(new c=0;c<MAX_MEDIC_CARS;c++)
    if(vehicleid == MedicCar[code=c])
    {
    if(Team[playerid] != EQMC)
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Arzt!");
    return 1;
    }
    }
    ////////////////////////////////////////////////////////////////////////////////
    for(new c=0;c<MAX_TAXI_CARS;c++)
    if(vehicleid == TaxiCar[code=c])
    {
    if(Team[playerid] != Taxi)
    {
    TogglePlayerControllable(playerid,false);
    TogglePlayerControllable(playerid,true);
    SendClientMessage(playerid, Rot, "Du bist kein Taxifahrer!");
    return 1;
    }
    }
    return 1;
    }