/carkey geht nicht mehr

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 großes problem. Und zwar habe ich ein befehl wo man seinen schlüßel wechseln kann alles schön und gut hatt auch alles geklapt.
    Man konnte schlüßel wechseln und ein anderes car kaufen.
    Seit dem letzten restart des servers geht es nicht mehr. Man kann zwar seinen schlüßel wechseln aber keine anderen autos kaufen sondern nur noch eins woran kann es liegen.
    Wenn ihr irgendwelche sachen aus dem Script braucht bitte sagen was genau ich hoffe ihr könnt helfen

  • Da ich nicht weiß welchen code du gemau meinst hier der /carkey code





    if (strcmp("/carkey", cmdtext, true, 10) == 0)
    {
    new mv = MaxVeh;
    if(mv > 1)
    {
    Dtc_PlayerKey[playerid] += 1;
    if(Dtc_PlayerKey[playerid] == MaxVeh)
    {
    Dtc_PlayerKey[playerid] = 0;
    }
    if(Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
    {
    format(string, sizeof(string), "Du nimmst deinen %dten Auto-Schlüssel, für deinen %s!",Dtc_PlayerKey[playerid]+1,CarName[PlayerCar[playerid][Dtc_PlayerKey[playerid]][CarModel]-400]);
    }
    else
    {
    format(string, sizeof(string), "Du nimmst deinen %dten Auto-Schlüssel, doch hast für diesen Schlüssel noch kein Auto!",Dtc_PlayerKey[playerid]+1);
    }
    SendClientMessage(playerid,COLOR_YELLOW,string);
    }
    return 1;
    }

  • Ok Also hier ist alles was damit zutun hatt aber es hatte ja vorher alles geklappt und plötzlich kann man nur noch 1 auto kaufen


    Sorry wenn es etwas viel ist an codes



    public OnPlayerPickUpPickup(playerid,pickupid)
    {
    for(new x = 0; x < AUTOHAUSER;x++)
    {
    if(PlayerToPoint(1.5, playerid, DtcSonstiges[x][0][0],DtcSonstiges[x][0][1],DtcSonstiges[x][0][2]) && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]] || pickupid == Dtc_Info[x] && !Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
    {
    TogglePlayerControllable(playerid, 0);
    SetPlayerVirtualWorld(playerid,55+playerid);
    new string[246];
    dtc_AutohausCar[playerid] = 0;
    dtc_AutohausCat[playerid] = x;
    new c1 = random(120);
    new c2 = random(120);
    new car;
    new preis;
    for(new ah = 0; ah < sizeof(dtcKaufliste);ah++)
    {
    if(car == 0 && dtcKaufliste[ah][dtc_Autohaus] == x)
    {
    car = dtcKaufliste[ah][dtc_CarModel];
    preis = dtcKaufliste[ah][dtc_CarModel];
    }
    }
    SetPlayerCameraPos(playerid, DtcSonstiges[x][2][0],DtcSonstiges[x][2][1],DtcSonstiges[x][2][2]);
    SetPlayerCameraLookAt(playerid, DtcSonstiges[x][1][0],DtcSonstiges[x][1][1],DtcSonstiges[x][1][2]);
    dtc_AutohausSCar[playerid] = CreateVehicle(car, DtcSonstiges[x][1][0],DtcSonstiges[x][1][1],DtcSonstiges[x][1][2],DtcSonstiges[x][1][3],c1,c2,-1);
    SetPlayerPos(playerid, DtcSonstiges[x][3][0],DtcSonstiges[x][3][1],DtcSonstiges[x][3][2]);
    SetVehicleVirtualWorld(dtc_AutohausSCar[playerid],55+playerid);
    format(string,sizeof(string),"~r~---------- AUTOHAUS ----------~n~~g~Fahrzeug: ~w~%s~n~~g~Preis: ~w~$%d~n~~b~Auswaehlen:~n~~w~ <Num 4<~b~&~w~>Num 6> ~n~~b~Kaufen:~w~ Enter ~n~~b~Abbrechen:~w~ Tab",CarName[car-400],preis);
    if(!CarKauf[playerid])
    {
    CarKauf[playerid] = TextDrawCreate(200,310,string);
    TextDrawAlignment(CarKauf[playerid],1);
    TextDrawUseBox(CarKauf[playerid],1);
    TextDrawBoxColor(CarKauf[playerid],0x000000FF);
    TextDrawSetOutline(CarKauf[playerid],1);
    TextDrawBackgroundColor(CarKauf[playerid],COLOR_BLACK);
    TextDrawSetOutline(CarKauf[playerid],1);
    TextDrawFont(CarKauf[playerid], 2);
    //TextDrawSetProportional(CarKauf[playerid], 2);
    TextDrawTextSize(CarKauf[playerid],450,410);
    TextDrawShowForPlayer(playerid,CarKauf[playerid]);
    }
    else
    {
    TextDrawHideForPlayer(playerid,CarKauf[playerid]);
    TextDrawSetString(CarKauf[playerid],string);
    TextDrawShowForPlayer(playerid,CarKauf[playerid]);
    }
    }
    else if(PlayerToPoint(1.5, playerid, DtcSonstiges[x][0][0],DtcSonstiges[x][0][1],DtcSonstiges[x][0][2]) && Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]] || pickupid == Dtc_Info[x] && Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
    {
    new mv = MaxVeh;
    if(mv > 1)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du besitzt schon ein Fahrzeug mit deinem Ausgewählten Schlüssel !");
    SendClientMessage(playerid, COLOR_GREY, " Verkaufe es mit /carsell oder wechsel den Schlüssel mit /carkey !");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du besitzt schon ein Fahrzeug! Verkaufe es mit /carsell");
    }
    }
    }


    if (strcmp("/carhelp", cmdtext, true, 10) == 0)
    {
    SendClientMessage(playerid, COLOR_GREEN,"_______________________________________");
    SendClientMessage(playerid, COLOR_WHITE,"*** Commands *** /park /carlock /carkey /carsell");
    return 1;
    }



    #define MaxVeh 5 // Anzahl Möglicher Fahrzeuge pro Person!


    new Dtc_PlayerHaveCar[MAX_PLAYERS][MaxVeh];


    new PlayerCar[MAX_PLAYERS][MaxVeh][dtc_PlayerCar]; da drunter sind die ganzen auto namen



    dtc_AutohausCar[playerid] = 0;
    dtc_AutohausCat[playerid] = 2000;
    dtc_AutohausSCar[playerid] = 0;
    Dtc_PlayerKey[playerid] = 0;
    for(new i = 0; i < MaxVeh; i++)
    {
    Dtc_PlayerHaveCar[playerid][i] = 0;
    }
    OnPlayerCarLogin(playerid);
    for(new i = 0; i < 700; i++)
    {


    else if(PlayerToPoint(1.5, playerid, DtcSonstiges[x][0][0],DtcSonstiges[x][0][1],DtcSonstiges[x][0][2]) && Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]] || pickupid == Dtc_Info[x] && Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
    {
    new mv = MaxVeh;
    if(mv > 1)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du besitzt schon ein Fahrzeug mit deinem Ausgewählten Schlüssel !");
    SendClientMessage(playerid, COLOR_GREY, " Verkaufe es mit /carsell oder wechsel den Schlüssel mit /carkey !");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du besitzt schon ein Fahrzeug! Verkaufe es mit /carsell");
    }
    }
    }


    public OnVehicleRespray(playerid,vehicleid,color1,color2)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if (vehicleid == PlayerCar[playerid][x][CarId] && Dtc_PlayerHaveCar[playerid][x])
    {
    PlayerCar[playerid][x][CarC1] = color1;
    PlayerCar[playerid][x][CarC2] = color2;
    }
    }
    return 1;
    }



    public OnVehiclePaintjob(playerid,vehicleid,paintjobid)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if (vehicleid == PlayerCar[playerid][x][CarId] && Dtc_PlayerHaveCar[playerid][x])
    {
    PlayerCar[playerid][x][CarPJ] = paintjobid;
    PlayerCar[playerid][x][CarC1] = 1;
    PlayerCar[playerid][x][CarC2] = 1;
    }
    }
    return 1;
    }


    public OnVehicleSpawn(vehicleid)
    {
    Gas[vehicleid] = 20;
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(IsPlayerConnected(playerid) && Dtc_PlayerHaveCar[playerid][x])
    {
    if (vehicleid == PlayerCar[playerid][x][CarId])
    {
    SetTimerEx("CarTuning",700,0,"ii",playerid,x);
    }
    }


    public OnVehicleDeath(vehicleid)
    {
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(IsPlayerConnected(playerid) && Dtc_PlayerHaveCar[playerid][x])
    {
    if (vehicleid == PlayerCar[playerid][x][CarId])
    {
    DestroyVehicle(PlayerCar[playerid][x][CarId]);
    PlayerCarSpawn(playerid,x);
    }
    }



    public OnPlayerCarLogin(playerid)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(!Dtc_PlayerHaveCar[playerid][x])
    {
    new string2[128];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "/Autos/%s%d.dtcar", playername2,x);
    new File: UserFile = fopen(string2, io_read);
    if (UserFile)
    {
    Dtc_PlayerHaveCar[playerid][x] = 1;
    new key[ 256 ] , val[ 256 ];
    new Data[ 256 ];
    while ( fread( UserFile , Data , sizeof( Data ) ) )
    {
    key = ini_GetKey( Data );
    if( strcmp( key , "CarId" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarId] = strval( val ); }
    if( strcmp( key , "CarModel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarModel] = strval( val ); }
    if( strcmp( key , "CarPos_x" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_x] = floatstr( val ); }
    if( strcmp( key , "CarPos_y" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_y] = floatstr( val ); }
    if( strcmp( key , "CarPos_z" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPos_z] = floatstr( val ); }
    if( strcmp( key , "CarRotate" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRotate] = floatstr( val ); }
    if( strcmp( key , "CarNitro" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarNitro] = strval( val ); }
    if( strcmp( key , "CarHyd" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHyd] = strval( val ); }
    if( strcmp( key , "CarWheel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarWheel] = strval( val ); }
    if( strcmp( key , "CarAusp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarAusp] = strval( val ); }
    if( strcmp( key , "CarSideL" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideL] = strval( val ); }
    if( strcmp( key , "CarSideR" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSideR] = strval( val ); }
    if( strcmp( key , "CarFB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarFB] = strval( val ); }
    if( strcmp( key , "CarRB" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRB] = strval( val ); }
    if( strcmp( key , "CarSpoiler" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarSpoiler] = strval( val ); }
    if( strcmp( key , "CarRoof" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarRoof] = strval( val ); }
    if( strcmp( key , "CarHood" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarHood] = strval( val ); }
    if( strcmp( key , "CarVents" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarVents] = strval( val ); }
    if( strcmp( key , "CarLamps" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarLamps] = strval( val ); }
    if( strcmp( key , "CarPJ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPJ] = strval( val ); }
    if( strcmp( key , "CarC1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC1] = strval( val ); }
    if( strcmp( key , "CarC2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarC2] = strval( val ); }
    if( strcmp( key , "Preis" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerCar[playerid][x][CarPreis] = strval( val ); }
    }
    fclose(UserFile);
    PlayerCarSpawn(playerid,x);
    }
    }
    }
    }


    public OnVehicleMod(playerid,vehicleid,componentid)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if (vehicleid == PlayerCar[playerid][x][CarId] && Dtc_PlayerHaveCar[playerid][x])
    {
    if((componentid >= 1008) && (componentid <= 1010)) {PlayerCar[playerid][x][CarNitro] = componentid;}
    if((componentid >= 1142) && (componentid <= 1145)) {PlayerCar[playerid][x][CarVents] = componentid;}
    if((componentid == 1013) || (componentid == 1024)) {PlayerCar[playerid][x][CarLamps] = componentid;}
    if((componentid >= 1004) && (componentid <= 1005)||(componentid >= 1011) && (componentid <= 1012)) {PlayerCar[playerid][x][CarHood] = componentid;}
    if(componentid == 1087) {PlayerCar[playerid][x][CarHyd] = componentid;}
    if(componentid == 1086) {PlayerCar[playerid][x][CarHyd] = componentid;}
    if(IsAWheel(componentid)) {PlayerCar[playerid][x][CarWheel] = componentid;}
    if(IsAExhaust(componentid)) {PlayerCar[playerid][x][CarAusp] = componentid;}
    if(IsASideL(componentid)) {PlayerCar[playerid][x][CarSideL] = componentid; PlayerCar[playerid][x][CarSideR] = SideR;}
    if(IsASideR(componentid)) {PlayerCar[playerid][x][CarSideR] = componentid; PlayerCar[playerid][x][CarSideL] = SideL;}
    if(IsAFB(componentid)) {PlayerCar[playerid][x][CarFB] = componentid;}
    if(IsARB(componentid)) {PlayerCar[playerid][x][CarRB] = componentid;}
    if(IsASpoiler(componentid)) {PlayerCar[playerid][x][CarSpoiler] = componentid;}
    if(IsARoof(componentid)) {PlayerCar[playerid][x][CarRoof] = componentid;}
    }
    }
    return 1;



    public OnPlayerCarUpdate(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(Dtc_PlayerHaveCar[playerid][x])
    {
    DestroyVehicle(PlayerCar[playerid][x][CarId]);
    Dtc_Carlock[PlayerCar[playerid][x][CarId]] = 0;
    Dtc_LockCar(PlayerCar[playerid][x][CarId]);
    new string3[128];
    new playername3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));
    format(string3, sizeof(string3), "/Autos/%s%d.dtcar", playername3,x);
    new File: hFile = fopen(string3, io_write);
    if (hFile)
    {
    new var[32];
    format(var, 32, "CarId=%d\n",PlayerCar[playerid][x][CarId]);fwrite(hFile, var);
    format(var, 32, "CarModel=%d\n",PlayerCar[playerid][x][CarModel]);fwrite(hFile, var);
    format(var, 32, "CarPos_x=%.3f\n",PlayerCar[playerid][x][CarPos_x]);fwrite(hFile, var);
    format(var, 32, "CarPos_y=%.3f\n",PlayerCar[playerid][x][CarPos_y]);fwrite(hFile, var);
    format(var, 32, "CarPos_z=%.3f\n",PlayerCar[playerid][x][CarPos_z]);fwrite(hFile, var);
    format(var, 32, "CarRotate=%.3f\n",PlayerCar[playerid][x][CarRotate]);fwrite(hFile, var);
    format(var, 32, "CarNitro=%d\n",PlayerCar[playerid][x][CarNitro]);fwrite(hFile, var);
    format(var, 32, "CarHyd=%d\n",PlayerCar[playerid][x][CarHyd]);fwrite(hFile, var);
    format(var, 32, "CarWheel=%d\n",PlayerCar[playerid][x][CarWheel]);fwrite(hFile, var);
    format(var, 32, "CarAusp=%d\n",PlayerCar[playerid][x][CarAusp]);fwrite(hFile, var);
    format(var, 32, "CarSideL=%d\n",PlayerCar[playerid][x][CarSideL]);fwrite(hFile, var);
    format(var, 32, "CarSideR=%d\n",PlayerCar[playerid][x][CarSideR]);fwrite(hFile, var);
    format(var, 32, "CarFB=%d\n",PlayerCar[playerid][x][CarFB]);fwrite(hFile, var);
    format(var, 32, "CarRB=%d\n",PlayerCar[playerid][x][CarRB]);fwrite(hFile, var);
    format(var, 32, "CarSpoiler=%d\n",PlayerCar[playerid][x][CarSpoiler]);fwrite(hFile, var);
    format(var, 32, "CarRoof=%d\n",PlayerCar[playerid][x][CarRoof]);fwrite(hFile, var);
    format(var, 32, "CarHood=%d\n",PlayerCar[playerid][x][CarHood]);fwrite(hFile, var);
    format(var, 32, "CarVents=%d\n",PlayerCar[playerid][x][CarVents]);fwrite(hFile, var);
    format(var, 32, "CarLamps=%d\n",PlayerCar[playerid][x][CarLamps]);fwrite(hFile, var);
    format(var, 32, "CarPJ=%d\n",PlayerCar[playerid][x][CarPJ]);fwrite(hFile, var);
    format(var, 32, "CarC1=%d\n",PlayerCar[playerid][x][CarC1]);fwrite(hFile, var);
    format(var, 32, "CarC2=%d\n",PlayerCar[playerid][x][CarC2]);fwrite(hFile, var);
    format(var, 32, "Preis=%d\n",PlayerCar[playerid][x][CarPreis]);fwrite(hFile, var);
    fclose(hFile);
    }
    }
    }
    }
    }


    public IsADtCar(car) //!CallRemoteFunction("IsADtCar","i",c)
    {
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    if(IsPlayerConnected(playerid) && Dtc_PlayerHaveCar[playerid][x])
    {
    if (car == PlayerCar[playerid][x][CarId])
    {
    return 1;
    }
    }
    }
    }
    return 0;