Befehl soll nur im CopCar funzen

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 Leute.


    Habe ein Problem.. und zwar...



    if(strcmp(cmd, "/fixcopcar", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gTeam[playerid] == 2 || IsACop(playerid))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_GREEN, "Dein Streifenwagen wurde Repariert!");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "Du sitzt in keinem Streifenwagen!");
    }
    }
    return 1;
    }
    }


    Das Problem ist nun.. ich kann als Cop JEDES auto fixen!.. Das soll aber nur mit Streifenwagen gehen... ich habe schon ne zeitlang rumprobiert.. ist wahrscheinlich für euch ganz einfach aber ich breche mir damit einem ab-.-... sonst geht alles.. sprich man kann nur als cop den befehl ausüben.. nur wie ich das nun auf die Streifenwagen beschränke ist mir ein räzel-.-



    Danke im Vorraus ..


    MFG Namex

    70% der Breadfish Mitglieder sind kiddys, wenn du mir auch zustimmst dann kopiere diesen Text in deine Signatur! ^^

  • Zeig mal deine Cop Cars..
    Sind die so im Array:

    Police[0] = Addstaticvehicle...
    Police[1]= usw


    ?

  • if(strcmp(cmd, "/fixcopcar", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gTeam[playerid] == 2 || IsACop(playerid))
    {
    if(GetPlayerVehicleID(playerid) == polizei[9])//musstd u an dein System anpassen
    {
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_GREEN, "Dein Streifenwagen wurde Repariert!");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "Du sitzt in keinem Streifenwagen!");
    }
    }
    return 1;
    }
    }

  • Wie genau meintst du das? einmal habe ich die hier stehen



    public IsACopCar(carid)
    {
    if((carid >= 35) && (carid <= 60) || carid == 66 || carid == 67 || carid == 91 || carid == 92 || carid == 93 || carid == 36 || carid == 134 || carid == 135 || carid == 136)
    {
    if(carid == 45 || carid == 46 || carid == 55 || carid == 59) { return 0; }
    return 1;
    }
    return 0;
    }


    und in der liste sind sie so:



    AddStaticVehicleEx(596,1601.308000,-1621.916000,13.056540,90.0, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,1535.8275,-1678.0283,13.1680,359.9876, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,1561.860000,-1694.905000,6.139762,222.0,-1, -1, 60000);/*CopCruiser*/

    70% der Breadfish Mitglieder sind kiddys, wenn du mir auch zustimmst dann kopiere diesen Text in deine Signatur! ^^


  • nein so ist falsch, du musst eine Schleife machen, die jedes Copcar durchgeht!!


    Also poste mal die Definition der copcars bei dir, dann mach ich das

  • meinste das?

    AddStaticVehicleEx(596,-1381.9910,457.0832,6.9837,0.1452, 44, 86, 60000);/*Patriot cruiser*/
    AddStaticVehicleEx(596,1558.392000,-1710.859000,5.466783,1.0, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,1569.639000,-1710.859000,5.466783,1.0, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,-2139.1995,-2393.7671,30.3452,140.7012, 0, 0, 60000);/*CopCruiser*/
    AddStaticVehicleEx(425,-1279.8262,493.3734,18.0309,219.1345, -1, -1, 60000);/*Hunter*/
    AddStaticVehicleEx(425,-1291.0063,492.3819,18.0305,223.8306, -1, -1, 60000);/*Hunter*/
    AddStaticVehicleEx(596,1601.308000,-1621.916000,13.056540,90.0, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,1535.8275,-1678.0283,13.1680,359.9876, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,1561.860000,-1694.905000,6.139762,222.0,-1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(470,-1375.1555,457.5534,6.9837,359.8331,-1, -1, 60000);/*Patriot*/
    AddStaticVehicleEx(467,1067.1295,-295.5681,73.7826,179.6040, 90, -1, 60000);/*Hitman Oceanic*/
    AddStaticVehicleEx(467,1077.3829,-295.1148,73.7812,180.2754, 90, -1, 60000);/*Hitman Oceanic*/
    AddStaticVehicleEx(596,614.8,-588.5,17.4,240.0, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,635.1,-561.5,16.5,180.0, -1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,-2177.5759,-2362.5042,30.4296,141.0939, 0, 0, 60000);/*CopCruiser*/
    AddStaticVehicleEx(490,1539.392000,-1646.262000,6.274928,180.0, -1, -1, 60000);/*FBI Rancher*/
    AddStaticVehicleEx(490,1531.254000,-1647.431000,6.274976,200.0, -1, -1, 60000);/*FBI Rancher*/
    AddStaticVehicleEx(470,-1363.1493,457.1042,6.9836,359.6740, -1, -1, 60000);/*Patriot*/
    AddStaticVehicleEx(470,-1355.5931,456.7297,6.9836,0.0286, -1, -1, 60000);/*Patriot*/
    AddStaticVehicleEx(596,1535.8459,-1668.7560,13.2653,359.7447,-1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(407,-2550.1443,610.7148,14.3281,90.6597, -1, -1, 60000);/*FireTruck*/
    AddStaticVehicleEx(596,-2181.2766,-2375.6953,30.3405,231.7148, 0, 0, 60000);/*CopCruiser*/
    AddStaticVehicleEx(596,1545.7845,-1684.4004,5.6342,271.1593, 89, 1, 60000);/*General Car*/
    AddStaticVehicleEx(596,1530.1611,-1676.0326,5.4563,231.7766, 89, 1, 60000);/*General Car*/
    AddStaticVehicleEx(407,-2551.8792,587.1581,14.3281,90.4374,-1, -1, 60000);/*FireTruck*/
    AddStaticVehicleEx(497,1563.8436,-1645.4883,28.5789,91.4940,0,1, 60000);/*Police Maveric*/
    AddStaticVehicleEx(416,-2637.0630,617.3499,14.3281,90.1464, -1, -1, 60000);/*Ambulance*/
    AddStaticVehicleEx(416,-2661.4282,617.3460,14.3288,89.2072, -1, -1, 60000);/*Ambulance*/
    AddStaticVehicleEx(416,-2662.4568,595.3354,14.3281,273.2716, -1, -1, 60000);/*Ambulance*/
    AddStaticVehicleEx(431,1172.5,-1795.5,13.1,0.0, -1, -1, 60000);//64/*Bus*/
    AddStaticVehicleEx(431,1182.1,-1795.9,13.1,0.0, -1, -1, 60000);//65/*Bus*/
    AddStaticVehicleEx(430,-1443.4342,427.0862,-0.6994,268.8489,-1, -1, 60000);/*NG BOAT*/
    AddStaticVehicleEx(430,-1442.0721,390.6206,-0.4339,270.1023,-1, -1, 60000);/*NG BOAT*/
    AddStaticVehicleEx(467,1071.9189,-294.9166,73.7250,178.9444,90, -1, 60000);//68/*Hitman Oceanic*/
    AddStaticVehicleEx(405,-2082.3562,-117.3896,34.9299,177.0056,17, 17, 60000);//69 Driving School /*Sentinel*/
    AddStaticVehicleEx(405,-2072.5933,-117.4564,34.9383,178.0982,17, 17, 60000);//Driving School/*Sentinel*/
    AddStaticVehicleEx(405,-2062.4253,-117.6652,34.9347,180.8394,17, 17, 60000);//Driving School/*Sentinel*/
    AddStaticVehicleEx(434,551.7929,-1285.5260,16.9303,0.4147,-1, -1, 60000);//Rent car/*Hotknife*/
    AddStaticVehicleEx(568,536.9888,-1286.5275,16.9993,359.1704,-1, -1, 60000); //Rent car/*Bandito*/
    AddStaticVehicleEx(434,544.1793,-1286.1422,16.9492,7.3116,-1, -1, 60000);//Rent car/*Hotknife*/
    AddStaticVehicleEx(434,-1949.9493,258.1949,35.1922,70.7581,-1, -1, 60000); //Rent car/*Hotknife*/
    AddStaticVehicleEx(568,-1948.1650,264.8094,35.1930,72.6982,-1, -1, 60000); //Rent car/*Bandito*/
    AddStaticVehicleEx(434,-1947.0601,270.3815,35.1954,66.0783,-1, -1, 60000); //Rent car/*Hotknife*/
    AddStaticVehicleEx(456,2795.2,-2417.8,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
    AddStaticVehicleEx(456,2783.9,-2417.9,13.4,90.8,-1,-1,60000);//Component Truck/*Yankee*/
    AddStaticVehicleEx(440,2794.1,-2455.9,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
    AddStaticVehicleEx(440,2782.9,-2455.6,13.4,90.8,-1,-1,60000);//Component Truck/*Rumpo*/
    AddStaticVehicleEx(420,1307.8883,-855.1977,39.3574,267.9671,6,1, 60000);//Taxi/*Taxi*/------------------------------------------------
    AddStaticVehicleEx(487,-2703.3201,624.0250,14.1766,180.2649, 1, 3, 60000);//Medic Chopper/*Maverick*/
    AddStaticVehicleEx(420,1308.0876,-859.5128,39.3579,269.0271,6,1, 60000);//Taxi/*Taxi*/---------------------------------------------
    AddStaticVehicleEx(420,1307.8380,-869.9398,39.3597,269.7744,6,1, 60000);//Taxi //CAR ID 85/*Taxi*/---------------------------------
    AddStaticVehicleEx(452,720.1,-1694.0,-0.4,179.4,-1,-1,60000);//Fishboat/*Speeder*/
    AddStaticVehicleEx(452,721.2,-1629.4,-0.4,180.9,-1,-1,60000);//Fishboat/*Speeder*/
    AddStaticVehicleEx(452,739.5,-1670.5,-0.6,177.5,-1,-1,60000);//Fishboat/*Speeder*/
    AddStaticVehicleEx(452,-1474.4949,693.0169,0.1996,0.0751,-1,-1,60000);//Fishboat SF/*Speeder*/
    AddStaticVehicleEx(452,-1720.0717,1439.6177,-0.4913,357.6789,-1,-1,60000);//Fishboat SF/*Speeder*/
    AddStaticVehicleEx(520,-1430.4078,508.1596,18.9400,269.6329,44,86,60000);//NG Plane id 91
    AddStaticVehicleEx(520,-1419.9038,493.5340,18.9350,269.6848,44,86,60000);//NG Plane id 92
    AddStaticVehicleEx(520,-1398.6207,507.7513,18.9328,269.8143,44,86,60000); //NG Plane id 93
    AddStaticVehicleEx(420,1308.1163,-863.6590,39.3595,269.8208,6,1,60000);//Taxi-----------------------------------------------------
    AddStaticVehicleEx(487,1088.1736,-294.8004,73.7886,134.9237, 0, 1, 60000); //Hitman Chopper
    AddStaticVehicleEx(488,-2044.1797,479.9963,35.1399,180.0648,-1,-1,60000); // newschopper
    AddStaticVehicleEx(582,-2022.6146,458.6767,35.1414,0.7133,-1,-1,60000); // newsvan
    AddStaticVehicleEx(582,-2031.3779,459.0133,35.1362,359.7429,-1,-1,60000); // newsvan
    AddStaticVehicleEx(593,382.5172,2536.9561,16.5338,179.7261,-1,-1,60000);//Flyschool
    AddStaticVehicleEx(513,348.3660,2536.9792,16.7418,178.8195,-1,-1,60000);//Flyschool
    AddStaticVehicleEx(487,365.4068,2537.0327,16.6645,181.9959,-1,-1,60000);//Flyschool
    AddStaticVehicleEx(593,-1429.2843,-505.8203,13.7824,205.7709,-1,-1,60000);//Airport SF
    AddStaticVehicleEx(593,-1462.4779,-524.2803,13.7832,204.8137,-1,-1,60000);//Airport SF
    AddStaticVehicleEx(593,1907.7614,-2624.4097,13.5416,53.1810,-1,-1,60000);//Airport LS
    AddStaticVehicleEx(593,1887.0736,-2627.6543,13.5394,52.6116,-1,-1,60000);//Airport LS
    AddStaticVehicleEx(513,-1354.3270,-466.5467,13.7827,162.0134,-1,-1,60000);//Airport SF
    AddStaticVehicleEx(513,-1390.3510,-482.7985,13.7883,250.3124,-1,-1,60000);//Airport SF
    AddStaticVehicleEx(513,1835.3215,-2624.1938,13.5405,56.0569,-1,-1,60000);//Airport LS
    AddStaticVehicleEx(513,1813.2893,-2625.6296,13.5394,53.2858,-1,-1,60000);//Airport LS
    AddStaticVehicleEx(571,2286.2141,-2354.5000,12.8306,225.8705,-1,-1,60000); // kart
    AddStaticVehicleEx(571,2279.9412,-2348.4141,12.8312,225.8585,-1,-1,60000); // kart
    AddStaticVehicleEx(571,2291.7932,-2345.5356,12.8305,227.3060,-1,-1,60000); // kart
    AddStaticVehicleEx(571,2287.5615,-2341.6433,12.8306,226.5350,-1,-1,60000); // kart
    AddStaticVehicleEx(571,2299.6785,-2338.3186,12.8307,224.3563,-1,-1,60000); // kart
    AddStaticVehicleEx(571,2295.3887,-2334.9448,12.8307,227.9102,-1,-1,60000); // kart


    oder was meinste mit

    70% der Breadfish Mitglieder sind kiddys, wenn du mir auch zustimmst dann kopiere diesen Text in deine Signatur! ^^

  • Ja das musst du besser ändern:

    //oben
    new Police[50];


    und dann bei Ongamemodeinit:


    Police[0] = AddStaticVehicleEx(596,-1381.9910,457.0832,6.9837,0.1452, 44, 86, 60000);/*Patriot cruiser*/


    usw

  • if(strcmp(cmd, "/fixcopcar", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gTeam[playerid] == 2 || IsACop(playerid))
    {
    if(IsACopCar(playerid))
    {
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_GREEN, "Dein Streifenwagen wurde Repariert!");
    return 1;
    }
    else SendClientMessage(playerid,COLOR_GREY,"Du bist in keinem Streifenwagen!");
    }
    else SendClientMessage(playerid,COLOR_GREY,"Du bist kein Polizist!");
    }
    }


    Ausprobieren bitte. :)

    [align=center]

  • Er hat doch nichtmal die Funktion IsACopCar ?(
    Wies soll es dann funktionieren!



    new Police[12];


    if(strcmp(cmd, "/fixcopcar", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gTeam[playerid] == 2 || IsACop(playerid))
    {
    for(new i;i<sizeof(Police);i++)
    {
    if(GetPlayerVehicleID(playerid) == Police[i])//musst du an dein System anpassen
    {
    RepairVehicle(GetPlayerVehicleID(playerid));
    SendClientMessage(playerid, COLOR_GREEN, "Dein Streifenwagen wurde Repariert!");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "Du sitzt in keinem Streifenwagen!");
    }
    }
    }
    return 1;
    }
    }
    //EDIT


    Police[0] = AddStaticVehicleEx(596,1558.392000,-1710.859000,5.466783,1.0, -1, -1, 60000);/*CopCruiser*/
    Police[1] = AddStaticVehicleEx(596,1569.639000,-1710.859000,5.466783,1.0, -1, -1, 60000);/*CopCruiser*/
    Police[2] = AddStaticVehicleEx(596,-2139.1995,-2393.7671,30.3452,140.7012, 0, 0, 60000);/*CopCruiser*/
    Police[3] = AddStaticVehicleEx(596,1601.308000,-1621.916000,13.056540,90.0, -1, -1, 60000);/*CopCruiser*/
    Police[4] = AddStaticVehicleEx(596,1535.8275,-1678.0283,13.1680,359.9876, -1, -1, 60000);/*CopCruiser*/
    Police[5] = AddStaticVehicleEx(596,1561.860000,-1694.905000,6.139762,222.0,-1, -1, 60000);/*CopCruiser*/
    Police[6] = AddStaticVehicleEx(596,614.8,-588.5,17.4,240.0, -1, -1, 60000);/*CopCruiser*/
    Police[7] = AddStaticVehicleEx(596,635.1,-561.5,16.5,180.0, -1, -1, 60000);/*CopCruiser*/
    Police[8] = AddStaticVehicleEx(596,-2177.5759,-2362.5042,30.4296,141.0939, 0, 0, 60000);/*CopCruiser*/
    Police[9] = AddStaticVehicleEx(596,1535.8459,-1668.7560,13.2653,359.7447,-1, -1, 60000);/*CopCruiser*/
    Police[10] = AddStaticVehicleEx(596,-2181.2766,-2375.6953,30.3405,231.7148, 0, 0, 60000);/*CopCruiser*/
    Police[11] = AddStaticVehicleEx(497,1563.8436,-1645.4883,28.5789,91.4940,0,1, 60000);/*Police Maveric*/


    Einmal editiert, zuletzt von #BLackYoda_ ()

  • Dann soll er Oben:
    new PolizeiVehs[50];


    und Unten:
    PolizeiVehs[0] = CreateVehicleEx
    PolizeiVehs[1] = CreateVehicleEx
    PolizeiVehs[2] = CreateVehicleEx
    PolizeiVehs[3] = CreateVehicleEx
    PolizeiVehs[4] = CreateVehicleEx
    PolizeiVehs[5] = CreateVehicleEx
    PolizeiVehs[6] = CreateVehicleEx
    .
    .
    .


    dann
    Function IsACopCar(carid)
    {
    for(new i = 0; i < sizeof(PolizeiVehs); i++)
    {
    if(carid == PolizeiVehs[i])
    {
    return 1;
    }
    }
    return 0;
    }

    [align=center]

  • Meinst wohl AddStaticVehicleEx und nicht Create^^.
    Habs da oben ja auch, aber hab jetzt nicht auf die Klammern geachtet
    :P

  • habe es nun geändert in :



    new Police[50];



    Police[0] = AddStaticVehicleEx(596,-1381.9910,457.0832,6.9837,0.1452, 44, 86, 60000);/*Patriot cruiser*/
    Police[1] = AddStaticVehicleEx(596,1558.392000,-1710.859000,5.466783,1.0, -1, -1, 60000);/*CopCruiser*/
    Police[2] = AddStaticVehicleEx(596,1569.639000,-1710.859000,5.466783,1.0, -1, -1, 60000);/*CopCruiser*/
    Police[3] = AddStaticVehicleEx(596,-2139.1995,-2393.7671,30.3452,140.7012, 0, 0, 60000);/*CopCruiser*/
    AddStaticVehicleEx(425,-1279.8262,493.3734,18.0309,219.1345, -1, -1, 60000);/*Hunter*/
    AddStaticVehicleEx(425,-1291.0063,492.3819,18.0305,223.8306, -1, -1, 60000);/*Hunter*/
    Police[4] = AddStaticVehicleEx(596,1601.308000,-1621.916000,13.056540,90.0, -1, -1, 60000);/*CopCruiser*/
    Police[5] = AddStaticVehicleEx(596,1535.8275,-1678.0283,13.1680,359.9876, -1, -1, 60000);/*CopCruiser*/
    Police[6] = AddStaticVehicleEx(596,1561.860000,-1694.905000,6.139762,222.0,-1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(470,-1375.1555,457.5534,6.9837,359.8331,-1, -1, 60000);/*Patriot*/
    AddStaticVehicleEx(467,1067.1295,-295.5681,73.7826,179.6040, 90, -1, 60000);/*Hitman Oceanic*/
    AddStaticVehicleEx(467,1077.3829,-295.1148,73.7812,180.2754, 90, -1, 60000);/*Hitman Oceanic*/
    Police[7] = AddStaticVehicleEx(596,614.8,-588.5,17.4,240.0, -1, -1, 60000);/*CopCruiser*/
    Police[8] = AddStaticVehicleEx(596,635.1,-561.5,16.5,180.0, -1, -1, 60000);/*CopCruiser*/
    Police[9] = AddStaticVehicleEx(596,-2177.5759,-2362.5042,30.4296,141.0939, 0, 0, 60000);/*CopCruiser*/
    AddStaticVehicleEx(490,1539.392000,-1646.262000,6.274928,180.0, -1, -1, 60000);/*FBI Rancher*/
    AddStaticVehicleEx(490,1531.254000,-1647.431000,6.274976,200.0, -1, -1, 60000);/*FBI Rancher*/
    AddStaticVehicleEx(470,-1363.1493,457.1042,6.9836,359.6740, -1, -1, 60000);/*Patriot*/
    AddStaticVehicleEx(470,-1355.5931,456.7297,6.9836,0.0286, -1, -1, 60000);/*Patriot*/
    Police[10] = AddStaticVehicleEx(596,1535.8459,-1668.7560,13.2653,359.7447,-1, -1, 60000);/*CopCruiser*/
    AddStaticVehicleEx(407,-2550.1443,610.7148,14.3281,90.6597, -1, -1, 60000);/*FireTruck*/
    Police[11] = AddStaticVehicleEx(596,-2181.2766,-2375.6953,30.3405,231.7148, 0, 0, 60000);/*CopCruiser*/
    Police[12] = AddStaticVehicleEx(596,1545.7845,-1684.4004,5.6342,271.1593, 89, 1, 60000);/*General Car*/
    Police[13] = AddStaticVehicleEx(596,1530.1611,-1676.0326,5.4563,231.7766, 89, 1, 60000);/*General Car*/
    AddStaticVehicleEx(407,-2551.8792,587.1581,14.3281,90.4374,-1, -1, 60000);/*FireTruck*/



    nun muss ich doch hier aber auch noch was ändern oder?

    public IsACopCar(carid)
    {
    if((carid >= 35) && (carid <= 60) || carid == 66 || carid == 67 || carid == 91 || carid == 92 || carid == 93 || carid == 36 || carid == 134 || carid == 135 || carid == 136)
    {
    if(carid == 45 || carid == 46 || carid == 55 || carid == 59) { return 0; }
    return 1;
    }
    return 0;
    }

    70% der Breadfish Mitglieder sind kiddys, wenn du mir auch zustimmst dann kopiere diesen Text in deine Signatur! ^^


  • public IsACopCar(carid)
    {
    for(new i;i<sizeof(Police);i++)
    {
    if(GetPlayerVehicleid(carid)==Police[i])
    {
    return 1;
    }
    }
    return 0;
    }