Nummernschild bug

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
  • Hey Breadfish forum,


    ich habe einen Bug mit meinem Nummernschild system.
    Ich habe es gemacht das es gespeichert wird aber wird es irgendwie nicht. Das alte nummernschild wird nicht vom neuen ersetzt. (nach dem restart)
    hier der Code.




    if(strcmp(cmd,"/anbringen",true) == 0) { new kz[15]; if(!IsPlayerInAnyVehicle(playerid)) { return SendClientMessage(playerid, COLOR_GRAD1, "Du bist in keinem Fahrzeug!"); } if(KennzeichenErlaubnis[playerid] == 0) { return SendClientMessage(playerid, COLOR_GRAD1, "Du hast kein Kennzeichen in der Stadthalle gekauft!"); } if(Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]]) { new rand = random(2); if(rand == 1 || rand == 0) { new kenzeichenzahl = 1 + random(2500); format(kz,sizeof(kz),"SF-%d",kenzeichenzahl); } if(rand == 2) { new kenzeichenzahl2 = 1 + random(55555); format(kz,sizeof(kz),"SF-%d",kenzeichenzahl2); } new vehiclefid = GetPlayerVehicleID(playerid); SetVehicleNumberPlate(vehiclefid, kz); SetVehicleToRespawn(vehiclefid); new Float: X,Float: Y,Float: Z; GetPlayerPos(playerid,X,Y,Z); SetVehiclePos(vehiclefid,X,Y,Z); PutPlayerInVehicle(playerid,vehiclefid,0); new name[MAX_PLAYER_NAME], str[128]; GetPlayerName(playerid, name, sizeof name); SendClientMessage(playerid,COLOR_LIGHTBLUE,"*Fahrzeug wurde in San Fierro registriert."); format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]); dini_Set(str, "Plate", kz); PlayerCar[playerid][Dtc_PlayerKey[playerid]][Plate] = kz; KennzeichenErlaubnis[playerid] = 0; } return 1; }

    Bleibt Geschmeidig!

  • if(strcmp(cmd,"/anbringen",true) == 0)
    {
    new kz[15];
    if(!IsPlayerInAnyVehicle(playerid)) { return SendClientMessage(playerid, COLOR_GRAD1, "Du bist in keinem Fahrzeug!"); }
    if(KennzeichenErlaubnis[playerid] == 0) { return SendClientMessage(playerid, COLOR_GRAD1, "Du hast kein Kennzeichen in der Stadthalle gekauft!"); }
    if(Dtc_PlayerHaveCar[playerid][Dtc_PlayerKey[playerid]])
    {
    new rand = random(2);
    if(rand == 1 || rand == 0)
    {
    new kenzeichenzahl = 1 + random(2500);
    format(kz,sizeof(kz),"SF-%d",kenzeichenzahl);
    }
    if(rand == 2)
    {
    new kenzeichenzahl2 = 1 + random(55555);
    format(kz,sizeof(kz),"SF-%d",kenzeichenzahl2);
    }
    new vehiclefid = GetPlayerVehicleID(playerid);
    SetVehicleNumberPlate(vehiclefid, kz);
    SetVehicleToRespawn(vehiclefid);
    new Float: X,Float: Y,Float: Z;
    GetPlayerPos(playerid,X,Y,Z);
    SetVehiclePos(vehiclefid,X,Y,Z);
    PutPlayerInVehicle(playerid,vehiclefid,0);
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof name);
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"*Fahrzeug wurde in San Fierro registriert.");
    format(str, sizeof str, "/Autos/%s%d.dtcar", name,Dtc_PlayerKey[playerid]);
    dini_Set(str, "Plate", kz);
    PlayerCar[playerid][Dtc_PlayerKey[playerid]][Plate] = kz;
    KennzeichenErlaubnis[playerid] = 0;
    }
    return 1;
    }

    Bleibt Geschmeidig!

  • Function OnGameModeExit()
    {
    Elevator_Destroy();
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    OnPlayerCarUpdate(i);
    PlayerUpdate(i);
    gPlayerLogged[i] = 0;
    DisablePlayerCheckpoint(i);
    }
    }
    for(new i = 0; i < AUTOHAUSER; i++)
    {
    DestroyPickup(Dtc_Info[i]);
    }
    for(new i; i < MAX_FLAMES; i++)
    {
    KillFire(i);
    }
    return 1;
    }


    Function 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);
    format(var, 32, "Plate=%s\n",PlayerCar[playerid][x][Plate]);fwrite(hFile, var);
    format(var, 32, "Tank=%d\n",PlayerCar[playerid][x][Tank]);fwrite(hFile,var);
    fclose(hFile);
    }
    }
    }
    }
    }

    Bleibt Geschmeidig!

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Aber


    if(strcmp(cmd, "/gmx", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if (PlayerInfo[playerid][pAdmin] >= 2000)
    {
    SaveStuff();
    GameModeExit();
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, "Das darfst du nicht tun !");
    }
    }
    return 1;
    }

    Bleibt Geschmeidig!

  • na eben doch mit der funktion OnPlayerCarUpdate(playerid)


    Function 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);
    format(var, 32, "Plate=%s\n",PlayerCar[playerid][x][Plate]);fwrite(hFile, var);
    format(var, 32, "Tank=%d\n",PlayerCar[playerid][x][Tank]);fwrite(hFile,var);
    fclose(hFile);
    }
    }
    }
    }
    }

    Bleibt Geschmeidig!

  • nö savest du net


    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    OnPlayerCarUpdate(i);


    du savest so viele Cars wie player aufen server sind.
    Wenn du allein bist savest du also Car 0 :D


    frag mich eh wie man auf die idee kommt ein player zu nehmen ums car zu saven


    Edit


    HÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ


    unction OnPlayerCarUpdate(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    for(new x = 0; x < MaxVeh; x++)
    {
    i


    Sprich angenommen 10 Gamer, führst du 10 x OnPlayerCarUpdate aus
    un dann dort je 10x savecar lol