SFPD Motor starten nur mit SFPD Card [Erkennt vID nicht - Warum?] [Hilfeeee]

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
  • Guten Tag,


    ich habe da mal wieder ein Problem.
    Ich habe SFPDCar's erstellt:


    oben:

    new sfpdcar[78];


    Dann unter OnGameModeInit():

    sfpdcar[0]=AddStaticVehicleEx(490,-1639.6329,649.3442,-5.1144,268.9654,0,0,never); ///////copsf
    sfpdcar[1]=AddStaticVehicleEx(490,-1640.3617,654.0757,-5.1148,270.2813,0,0,never); //
    sfpdcar[2]=AddStaticVehicleEx(490,-1639.9325,657.7183,-5.1156,269.4047,0,0,never); //
    sfpdcar[3]=AddStaticVehicleEx(490,-1639.3798,661.8989,-5.1145,269.0397,0,0,never); //sfpdcar
    sfpdcar[4]=AddStaticVehicleEx(490,-1639.2620,665.9763,-5.1139,272.4876,0,0,never); //
    sfpdcar[5]=AddStaticVehicleEx(490,-1639.6771,669.8566,-5.1149,269.7929,0,0,never); //
    sfpdcar[6]=AddStaticVehicleEx(490,-1639.3722,674.2225,-5.1144,270.1419,0,0,never); //
    sfpdcar[7]=AddStaticVehicleEx(490,-1639.3353,678.2271,-5.1146,270.3507,0,0,never); //
    sfpdcar[8]=AddStaticVehicleEx(490,-1639.5875,682.2808,-5.1141,269.9523,0,0,never); //
    sfpdcar[9]=AddStaticVehicleEx(490,-1639.2561,686.2857,-5.1136,271.0499,0,0,never); //
    sfpdcar[10]=AddStaticVehicleEx(427,-1600.4423,676.3304,-5.1104,359.7724,0,1,never); //sfpdcar
    sfpdcar[11]=AddStaticVehicleEx(427,-1595.9910,676.5110,-5.1102,359.9280,0,1,never); //sfpdcar
    sfpdcar[12]=AddStaticVehicleEx(427,-1622.8531,649.9026,-5.1103,89.7098,0,1,never); //sfpdcar
    sfpdcar[13]=AddStaticVehicleEx(427,-1622.9543,653.7303,-5.1104,89.7422,0,1,never); //sfpdcar
    sfpdcar[14]=AddStaticVehicleEx(601,-1590.2325,705.3193,-5.4769,268.4682,1,1,never); //
    sfpdcar[15]=AddStaticVehicleEx(601,-1590.3406,710.4698,-5.4834,271.5275,1,1,never); //
    sfpdcar[16]=AddStaticVehicleEx(597,-1573.3405,705.8781,-5.4724,89.3708,0,1,never); // policecar
    sfpdcar[17]=AddStaticVehicleEx(597,-1573.2139,710.3875,-5.4744,90.7779,0,1,never); // policecar
    sfpdcar[18]=AddStaticVehicleEx(597,-1573.2852,714.2159,-5.4734,89.8277,0,1,never); // policecar
    sfpdcar[19]=AddStaticVehicleEx(597,-1573.3083,718.3730,-5.4742,89.6535,0,1,never); // policecar
    sfpdcar[20]=AddStaticVehicleEx(597,-1573.3430,722.3468,-5.4720,89.5121,0,1,never); // policecar
    sfpdcar[21]=AddStaticVehicleEx(597,-1573.2793,726.4300,-5.4658,88.8785,0,1,never); // policecar
    sfpdcar[22]=AddStaticVehicleEx(597,-1573.3053,730.5205,-5.4755,90.4388,0,1,never); // policecar
    sfpdcar[23]=AddStaticVehicleEx(597,-1573.3154,734.7197,-5.4743,89.5190,0,1,never); // policecar
    sfpdcar[24]=AddStaticVehicleEx(597,-1573.3030,738.7032,-5.4741,89.9318,0,1,never); // policecar
    sfpdcar[25]=AddStaticVehicleEx(597,-1573.3677,742.8127,-5.4740,88.8606,0,1,never); // policecar
    sfpdcar[26]=AddStaticVehicleEx(599,-1616.7472,732.8671,-5.0530,358.8893,0,1,never); //sfpdcar
    sfpdcar[27]=AddStaticVehicleEx(599,-1612.5862,732.6011,-5.0492,0.2476,0,1,never); //sfpdcar
    sfpdcar[28]=AddStaticVehicleEx(528,-1616.5216,749.4088,-5.2010,179.3495,0,0,never); // sapdcar
    sfpdcar[29]=AddStaticVehicleEx(528,-1612.4913,749.4802,-5.1988,180.1477,0,0,never); // sapdcar
    sfpdcar[30]=AddStaticVehicleEx(528,-1608.5139,749.4432,-5.1849,180.0796,0,0,never); // sapdcar
    sfpdcar[31]=AddStaticVehicleEx(528,-1604.2991,749.4540,-5.1989,179.5075,0,0,never); // sapdcar
    sfpdcar[32]=AddStaticVehicleEx(528,-1600.5416,749.3610,-5.1983,179.6048,0,0,never); // sapdcar
    sfpdcar[33]=AddStaticVehicleEx(528,-1596.0308,749.2849,-5.1979,179.1725,0,0,never); // sapdcar
    sfpdcar[34]=AddStaticVehicleEx(528,-1592.3109,749.2571,-5.1980,181.0922,0,0,never); // sapdcar
    sfpdcar[35]=AddStaticVehicleEx(528,-1588.0917,749.2767,-5.1991,180.4288,0,0,never); // sapdcar
    sfpdcar[36]=AddStaticVehicleEx(528,-1584.0770,749.2226,-5.1981,179.7562,0,0,never); // sapdcar
    sfpdcar[37]=AddStaticVehicleEx(528,-1579.8254,749.2117,-5.1981,181.3149,0,0,never); // sapdcar
    sfpdcar[38]=AddStaticVehicleEx(427,-1596.3029,692.7300,-5.1087,181.4882,79,1,never); //sfpdcar
    sfpdcar[39]=AddStaticVehicleEx(427,-1600.3444,692.7585,-5.1103,180.3017,79,1,never); //sfpdcar
    sfpdcar[40]=AddStaticVehicleEx(427,-1604.6232,691.9413,-5.1102,179.1621,79,1,never); //sfpdcar
    sfpdcar[50]=AddStaticVehicleEx(497,-1679.2588,705.6166,30.7772,90.3289,0,1,never); // policehelisf 1
    sfpdcar[51]=AddStaticVehicleEx(430,-1476.6259,691.3134,-0.3113,180.5064,0,26,never); // policebootsf 1
    sfpdcar[52]=AddStaticVehicleEx(430,-1476.8607,715.2071,-0.3161,180.9778,0,26,never); // policebootsf 2
    sfpdcar[52]=AddStaticVehicleEx(497,-1650.2944,702.1344,38.4194,89.7503,0,1,never); // policehelisf 2
    sfpdcar[53]=AddStaticVehicleEx(599,252.3117,1807.0774,17.8287,329.5804,0,1,never); // policeranger in der army base 1
    sfpdcar[54]=AddStaticVehicleEx(599,246.1299,1808.0234,17.8305,328.5082,0,1,never); // policeranger in der army base 2
    sfpdcar[55]=AddStaticVehicleEx(599,239.6035,1809.2277,17.8303,325.2912,0,1,never); // policeranger in der army base 3
    sfpdcar[56]=AddStaticVehicleEx(597,-1632.4806,692.1833,-5.4729,180.3178,0,1,never); // sfpdcar
    sfpdcar[57]=AddStaticVehicleEx(597,-1628.6013,692.4105,-5.4731,181.5738,0,1,never); // sfpdcar
    sfpdcar[58]=AddStaticVehicleEx(597,-1624.6726,692.4290,-5.4733,180.0233,0,1,never); // sfpdcar
    sfpdcar[59]=AddStaticVehicleEx(597,-1621.0088,692.5871,-5.4732,181.5052,0,1,never); // sfpdcar
    sfpdcar[60]=AddStaticVehicleEx(597,-1616.8641,692.5141,-5.4744,179.3403,0,1,never); // sfpdcar
    sfpdcar[61]=AddStaticVehicleEx(523,-1605.2328,731.0583,-5.6661,335.1383,0,1,never); //
    sfpdcar[62]=AddStaticVehicleEx(523,-1606.0521,731.4241,-5.6730,335.1383,0,1,never); //
    sfpdcar[63]=AddStaticVehicleEx(523,-1606.8699,731.7949,-5.6716,335.1383,0,1,never); //
    sfpdcar[64]=AddStaticVehicleEx(523,-1607.6866,732.1669,-5.6707,335.1383,0,1,never); //
    sfpdcar[65]=AddStaticVehicleEx(523,-1608.5046,732.5357,-5.6789,335.1383,0,1,never); //
    sfpdcar[66]=AddStaticVehicleEx(523,-1609.3214,732.9081,-5.6714,335.1382,0,1,never); //
    sfpdcar[67]=AddStaticVehicleEx(523,-1604.4357,730.6243,-5.6720,334.8398,0,1,never); //
    sfpdcar[68]=AddStaticVehicleEx(522,-1615.2384,672.6167,-5.4093,271.7621,0,0,never); // sportmotorrad
    sfpdcar[69]=AddStaticVehicleEx(522,-1615.2556,673.5136,-5.3366,271.7621,0,0,never); // sportmotorrad
    sfpdcar[70]=AddStaticVehicleEx(522,-1615.2841,674.4105,-5.3449,271.7621,0,0,never); // sportmotorrad
    sfpdcar[71]=AddStaticVehicleEx(522,-1615.3118,675.3075,-5.3439,271.7621,0,0,never); // sportmotorrad
    sfpdcar[72]=AddStaticVehicleEx(522,-1615.3373,676.2045,-5.3365,271.7621,0,0,never); // sportmotorrad
    sfpdcar[73]=AddStaticVehicleEx(522,-1615.3634,677.1016,-5.3361,271.7621,0,0,never); // sportmotorrad
    sfpdcar[74]=AddStaticVehicleEx(522,-1615.3896,677.9987,-5.3360,271.7621,0,0,never); // sportmotorrad
    sfpdcar[75]=AddStaticVehicleEx(522,-1615.4160,678.8958,-5.3355,271.7621,0,0,never); // sportmotorrad
    sfpdcar[76]=AddStaticVehicleEx(522,-1615.4417,679.7928,-5.3350,271.7621,0,0,never); // sportmotorrad
    sfpdcar[77]=AddStaticVehicleEx(522,-1615.4797,680.7368,-5.7231,269.4490,0,0,never); // sportmotorrad
    SetVehicleNumberPlate(sfpdcar[0],"SFPD");
    SetVehicleNumberPlate(sfpdcar[1],"SFPD");
    SetVehicleNumberPlate(sfpdcar[2],"SFPD");
    SetVehicleNumberPlate(sfpdcar[3],"SFPD");
    SetVehicleNumberPlate(sfpdcar[4],"SFPD");
    SetVehicleNumberPlate(sfpdcar[5],"SFPD");
    SetVehicleNumberPlate(sfpdcar[6],"SFPD");
    SetVehicleNumberPlate(sfpdcar[7],"SFPD");
    SetVehicleNumberPlate(sfpdcar[8],"SFPD");
    SetVehicleNumberPlate(sfpdcar[9],"SFPD");
    SetVehicleNumberPlate(sfpdcar[10],"SFPD");
    SetVehicleNumberPlate(sfpdcar[11],"SFPD");
    SetVehicleNumberPlate(sfpdcar[12],"SFPD");
    SetVehicleNumberPlate(sfpdcar[13],"SFPD");
    SetVehicleNumberPlate(sfpdcar[14],"SFPD");
    SetVehicleNumberPlate(sfpdcar[15],"SFPD");
    SetVehicleNumberPlate(sfpdcar[16],"SFPD");
    SetVehicleNumberPlate(sfpdcar[17],"SFPD");
    SetVehicleNumberPlate(sfpdcar[18],"SFPD");
    SetVehicleNumberPlate(sfpdcar[19],"SFPD");
    SetVehicleNumberPlate(sfpdcar[20],"SFPD");
    SetVehicleNumberPlate(sfpdcar[21],"SFPD");
    SetVehicleNumberPlate(sfpdcar[22],"SFPD");
    SetVehicleNumberPlate(sfpdcar[23],"SFPD");
    SetVehicleNumberPlate(sfpdcar[24],"SFPD");
    SetVehicleNumberPlate(sfpdcar[25],"SFPD");
    SetVehicleNumberPlate(sfpdcar[26],"SFPD");
    SetVehicleNumberPlate(sfpdcar[27],"SFPD");
    SetVehicleNumberPlate(sfpdcar[28],"SFPD");
    SetVehicleNumberPlate(sfpdcar[29],"SFPD");
    SetVehicleNumberPlate(sfpdcar[30],"SFPD");
    SetVehicleNumberPlate(sfpdcar[31],"SFPD");
    SetVehicleNumberPlate(sfpdcar[32],"SFPD");
    SetVehicleNumberPlate(sfpdcar[33],"SFPD");
    SetVehicleNumberPlate(sfpdcar[34],"SFPD");
    SetVehicleNumberPlate(sfpdcar[35],"SFPD");
    SetVehicleNumberPlate(sfpdcar[36],"SFPD");
    SetVehicleNumberPlate(sfpdcar[37],"SFPD");
    SetVehicleNumberPlate(sfpdcar[38],"SFPD");
    SetVehicleNumberPlate(sfpdcar[39],"SFPD");
    SetVehicleNumberPlate(sfpdcar[40],"SFPD");
    SetVehicleNumberPlate(sfpdcar[41],"SFPD");
    SetVehicleNumberPlate(sfpdcar[42],"SFPD");
    SetVehicleNumberPlate(sfpdcar[43],"SFPD");
    SetVehicleNumberPlate(sfpdcar[44],"SFPD");
    SetVehicleNumberPlate(sfpdcar[45],"SFPD");
    SetVehicleNumberPlate(sfpdcar[46],"SFPD");
    SetVehicleNumberPlate(sfpdcar[47],"SFPD");
    SetVehicleNumberPlate(sfpdcar[48],"SFPD");
    SetVehicleNumberPlate(sfpdcar[49],"SFPD");
    SetVehicleNumberPlate(sfpdcar[50],"SFPD");
    SetVehicleNumberPlate(sfpdcar[51],"SFPD");
    SetVehicleNumberPlate(sfpdcar[52],"SFPD");
    SetVehicleNumberPlate(sfpdcar[53],"SFPD");
    SetVehicleNumberPlate(sfpdcar[54],"SFPD");
    SetVehicleNumberPlate(sfpdcar[55],"SFPD");
    SetVehicleNumberPlate(sfpdcar[56],"SFPD");
    SetVehicleNumberPlate(sfpdcar[57],"SFPD");
    SetVehicleNumberPlate(sfpdcar[58],"SFPD");
    SetVehicleNumberPlate(sfpdcar[59],"SFPD");
    SetVehicleNumberPlate(sfpdcar[60],"SFPD");
    SetVehicleNumberPlate(sfpdcar[61],"SFPD");
    SetVehicleNumberPlate(sfpdcar[62],"SFPD");
    SetVehicleNumberPlate(sfpdcar[63],"SFPD");
    SetVehicleNumberPlate(sfpdcar[64],"SFPD");
    SetVehicleNumberPlate(sfpdcar[65],"SFPD");
    SetVehicleNumberPlate(sfpdcar[66],"SFPD");
    SetVehicleNumberPlate(sfpdcar[67],"SFPD");
    SetVehicleNumberPlate(sfpdcar[68],"SFPD");
    SetVehicleNumberPlate(sfpdcar[69],"SFPD");
    SetVehicleNumberPlate(sfpdcar[70],"SFPD");
    SetVehicleNumberPlate(sfpdcar[71],"SFPD");
    SetVehicleNumberPlate(sfpdcar[72],"SFPD");
    SetVehicleNumberPlate(sfpdcar[73],"SFPD");
    SetVehicleNumberPlate(sfpdcar[74],"SFPD");
    SetVehicleNumberPlate(sfpdcar[75],"SFPD");
    SetVehicleNumberPlate(sfpdcar[76],"SFPD");
    SetVehicleNumberPlate(sfpdcar[77],"SFPD");



    Dann unter OnPlayerKeyStateChange(playerid, newkeys, oldkeys):

    if(newkeys == 16384)
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    new vID = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vID) == 509 || GetVehicleModel(vID) == 481 || GetVehicleModel(vID) == 510)return 1;//Überprüft ob das Fahrzeug ein Fahrrad ist (wie im Command oben)
    if(GetPlayerVehicleSeat(playerid) == 0)
    {
    if(Motor[vID] == false)
    {
    SendClientMessage(playerid, LILA, "Der Motor wird gestartet...");
    if(Tank[vID] < 1)return SetTimerEx("Motortankleer",2000, 0, "i", playerid);
    if(Batterie[vID] < 1)return SetTimerEx("Motorbatterieleer",2000, 0, "i", playerid);
    SetTimerEx("Motorstarten", 2000, 0, "ii", vID, playerid);
    }
    else if(Motor[vID] == true)
    {
    GetVehicleParamsEx(vID,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vID,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[vID] = false;
    SendClientMessage(playerid, GRAU, "Motor abgeschaltet.");
    }
    }
    }
    }



    Hier der Timer "Motorstarten":

    public Motorstarten(vID, playerid)
    {
    for(new i=0; i<sizeof(sfpdcar); i++)
    {
    if(vID == sfpdcar[i])
    {
    SendClientMessage(playerid, ROT, "Test 1");//für mich zum testen
    if(SFPDCard[playerid] == 0)return SendClientMessage(playerid, GRAU, "Du hast keine SFPD Card um den Motor zu starten.");//Wenn der Spieler keine SFPD Card hat
    GetVehicleParamsEx(vID,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vID,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[vID] = true;
    return 1;
    }
    else
    {
    SendClientMessage(playerid, ROT, "Test 2");//für mich zum testen
    GetVehicleParamsEx(vID,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vID,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[vID] = true;
    return 1;
    }
    }
    return 1;
    }



    Und irgendwie erkennt er nicht die vID..
    Immer wenn ich im SFPD Car sitze und den Motor starte, steht da: "Test 2"
    Obwohl ich im SFPD Car sitze sollte er doch eigentlich "Test 1" anzeigen, doch dies tut er nicht.
    Nun bin ich mal wieder auf eure Hilfe angewiesen..
    Ich kann mir nicht erklären, warum er immer "Test 2" ausgibt, obwohl ich im SFPD Car sitze.


    Bitte um Hilfe


    Mit freundlichen Grüßen,
    Scripter4.0

    Scripter im Ruhestand.

  • Schon richtig, danke, aber hilft mir bei meinem Problem nicht viel weiter.. :(
    Trotzdem danke ;)



    hat sich erledigt, habs jetzt mit einer Variable gemacht:


    //oben:
    for(new i=0; i < MAX_PLAYERS; i++)
    {
    for(new v;v<78;v++)
    {
    SetVehicleParamsForPlayer(sfpdcar[v],i,0,1);
    Lock[sfpdcar[v]] = true;
    isPDCAR[sfpdcar[v]] = 1;//<<<<<<<<<<<<<<<<<<<hier

    }
    }




    //public motor starten:
    public Motorstarten(vID, playerid)
    {
    if(isPDCAR[vID] == 1)
    {
    if(SFPDCard[playerid] == 0)return SendClientMessage(playerid, GRAU, "Du hast keine SFPD Card um den Motor zu starten.");//Wenn der Spieler keine SFPD Card hat
    GetVehicleParamsEx(vID,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vID,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[vID] = true;
    return 1;
    }
    else
    {
    GetVehicleParamsEx(vID,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vID,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[vID] = true;
    }
    return 1;
    }




    Mfg

    Scripter im Ruhestand.

    Einmal editiert, zuletzt von Scripter4.0 ()