Bugfix

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

  • Function OnPlayerDisconnect(playerid, reason)
    {
    if(IsPlayerNPC(playerid)) return 1;
    new dateiname[MAX_PLAYER_NAME+4];
    new playername[MAX_PLAYER_NAME];
    new var[256];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(dateiname, sizeof(dateiname), "/Autos/%s.ini", playername);
    new File: CarFile = fopen(dateiname, io_write);
    format(var, 256, "AH_Typ=%i\n", Carlist[playerid][Typ]); fwrite(CarFile, var);
    format(var, 256, "AH_X=%f\n", Carlist[playerid][pos_x]); fwrite(CarFile, var);
    format(var, 256, "AH_Y=%f\n", Carlist[playerid][pos_y]); fwrite(CarFile, var);
    format(var, 256, "AH_Z=%f\n", Carlist[playerid][pos_z]); fwrite(CarFile, var);
    format(var, 256, "AH_Rot=%f\n", Carlist[playerid][z_angle]); fwrite(CarFile, var);
    format(var, 256, "AH_Status=%i\n", Carlist[playerid][Status]); fwrite(CarFile, var);
    format(var, 256, "AH_Lock=%i\n", Carlist[playerid][Lock]); fwrite(CarFile, var);
    format(var, 256, "AH_Paintjob=%i\n", Carlist[playerid][Paintjob]); fwrite(CarFile, var);
    format(var, 256, "AH_Farbe1=%i\n", Carlist[playerid][Farbe1]); fwrite(CarFile, var);
    format(var, 256, "AH_Farbe2=%i\n", Carlist[playerid][Farbe2]); fwrite(CarFile, var);
    format(var, 256, "AH_mod1=%i\n", Carlist[playerid][mod1]); fwrite(CarFile, var);
    format(var, 256, "AH_mod2=%i\n", Carlist[playerid][mod2]); fwrite(CarFile, var);
    format(var, 256, "AH_mod3=%i\n", Carlist[playerid][mod3]); fwrite(CarFile, var);
    format(var, 256, "AH_mod4=%i\n", Carlist[playerid][mod4]); fwrite(CarFile, var);
    format(var, 256, "AH_mod5=%i\n", Carlist[playerid][mod5]); fwrite(CarFile, var);
    format(var, 256, "AH_mod6=%i\n", Carlist[playerid][mod6]); fwrite(CarFile, var);
    format(var, 256, "AH_mod7=%i\n", Carlist[playerid][mod7]); fwrite(CarFile, var);
    format(var, 256, "AH_mod8=%i\n", Carlist[playerid][mod8]); fwrite(CarFile, var);
    format(var, 256, "AH_mod9=%i\n", Carlist[playerid][mod9]); fwrite(CarFile, var);
    format(var, 256, "AH_mod10=%i\n", Carlist[playerid][mod10]); fwrite(CarFile, var);
    format(var, 256, "AH_mod11=%i\n", Carlist[playerid][mod11]); fwrite(CarFile, var);
    format(var, 256, "AH_mod12=%i\n", Carlist[playerid][mod12]); fwrite(CarFile, var);
    format(var, 256, "AH_mod13=%i\n", Carlist[playerid][mod13]); fwrite(CarFile, var);
    format(var, 256, "AH_mod14=%i\n", Carlist[playerid][mod14]); fwrite(CarFile, var);
    format(var, 256, "AH_mod15=%i\n", Carlist[playerid][mod15]); fwrite(CarFile, var);
    format(var, 256, "AH_mod16=%i\n", Carlist[playerid][mod16]); fwrite(CarFile, var);
    format(var, 256, "AH_mod17=%i\n", Carlist[playerid][mod17]); fwrite(CarFile, var);
    fclose(CarFile);
    if(Carlist[playerid][Carid]!=-1)
    {
    SetVehicleParamsForAll(Carlist[playerid][Carid],0,0);
    DestroyVehicle(Carlist[playerid][Carid]);
    Carlist[playerid][Carid]=-1;
    }
    if (Spectating[playerid][0]!=-1)
    {
    SetVehicleParamsForAll(Kaufliste[Spectating[playerid][0]][Carid],0,0);
    Spectating[playerid][0]=-1;
    }
    if(Ticket[playerid][TicketStatus] != 0) {
    new xid = Ticket[playerid][TicketBearbeiter];
    Ticket[playerid][TicketStatus] = 0;
    Ticket[xid][TicketStatus] = 0;
    SetPlayerChatBubble(playerid, "", COLOR_YELLOW, 1.0, 1);
    }
    if (IsTowTrucker[playerid]==1)
    {
    IsTowTrucker[playerid]=0;
    TowTruckers--;
    }
    PlayerInfo[playerid][pAdjustable] = 1;
    new spname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, spname, sizeof(spname));
    //new ALLxstring[256];


    if(reason == 0)
    {
    format(ALLxstring, sizeof(ALLxstring), "%s hat den Server verlassen (Timeout)", spname);


    }
    else if(reason == 1)
    {
    format(ALLxstring, sizeof(ALLxstring), "%s hat den Server verlassen.", spname);


    }
    else if(reason == 2)
    {
    format(ALLxstring, sizeof(ALLxstring), "%s hat den Server verlassen (Kick/Ban/Exe-Crash)", spname);


    }


    SendClientMessage(playerid,COLOR_LIGHTGREEN, ALLxstring);


    for(new fs;fs<sizeof(FightSystem);fs++){
    if(FightSystem[fs][fsAttackFaction] != -255 && FightSystem[fs][fsFightTime]){
    if(FightSystem[fs][fsCTF][0] != -255 && FightSystem[fs][fsCTF][0] == playerid){
    new fsName[MAX_PLAYER_NAME];
    GetPlayerName(FightSystem[fs][fsCTF][0],fsName,MAX_PLAYER_NAME);
    new fsText[128];
    format(fsText,sizeof(fsText),"{FF000F}..:: | GangFight | ::.. |{FFFFFF} %s hat es nicht geschafft die Flagge zu erobern!",fsName);
    for(new i;i<MAX_PLAYERS;i++){
    if(IsPlayerConnected(i)){
    if(GetPlayerFaction(i) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(i) == FightSystem[fs][fsAttackFaction]){
    PlayerPlaySound(i,1058,0.0,0.0,0.0);
    SendClientMessage(i,FS_COL_YELLOW,fsText);
    }
    }
    }
    FightSystem[fs][fsCTF][0] = -255;
    FightSystem[fs][fsCTF][1] = 0;
    FightSystem[fs][fsCTF][2] = 0;
    }
    if(GetPVarInt(playerid,"Spawned")==1){
    GangZoneStopFlashForPlayer(playerid,FightSystem[fs][fsZoneID]);
    if(GetPlayerFaction(playerid) == FightSystem[fs][fsOwnerFaction] || GetPlayerFaction(playerid) == FightSystem[fs][fsAttackFaction]){
    TextDrawHideForPlayer(playerid,Fight);
    TextDrawHideForPlayer(playerid,FightUnderline);
    TextDrawHideForPlayer(playerid,FightSystem[fs][fsWinFaction]);
    TextDrawHideForPlayer(playerid,FightSystem[fs][fsLoseFaction]);
    TextDrawHideForPlayer(playerid,FightSystem[fs][fsWinKills]);
    TextDrawHideForPlayer(playerid,FightSystem[fs][fsLoseKills]);
    TextDrawHideForPlayer(playerid,FightSystem[fs][fsTime]);
    }
    }
    }GangZoneHideForPlayer(playerid,FightSystem[fs][fsZoneID]);
    }DeletePVar(playerid,"Spawned");
    KillTimer(TextDrawUpdate[playerid]);
    PlayerInfo[playerid][pAdjustable] = 1;



    if(AdminDuty[playerid] == 1)
    {
    Delete3DTextLabel(Admin[playerid]);
    Delete3DTextLabel(Supermod[playerid]);
    Delete3DTextLabel(Mod[playerid]);
    Delete3DTextLabel(Supporter[playerid]);
    SetPlayerColor(playerid,TEAM_HIT_COLOR);
    AdminDuty[playerid] = 0;
    }
    if(BlindFold[playerid] == 1)
    {
    BlindFold[playerid] = 0;
    }
    if(Noobi[playerid] == 1)
    {
    Delete3DTextLabel(Noob[playerid]);
    Noobi[playerid] = 0;
    }
    if(PlayerInfo[playerid][pMauled] == 1)
    {
    PlayerInfo[playerid][pMauled] = 0;
    }
    if(PlayerInfo[playerid][pMember] == 24 || PlayerInfo[playerid][pLeader] == 24 && BlitzerErstellt[playerid] == 1)
    {
    RemoveBlitzer(playerid);
    }
    if(PlayerTied[playerid] == 1)
    {
    PlayerInfo[playerid][pGangJailed] = 1;
    PlayerTied[playerid] = 0;
    }
    if(IsTowTrucker[playerid] == 1)
    {
    IsTowTrucker[playerid] = 0;
    TowTruckers--;
    }
    new sendername[MAX_PLAYER_NAME];
    new string[200];
    GetPlayerName(playerid,sendername,sizeof(sendername));


    MoneySpam[playerid] = 0;
    DestroyObject(Sperre[playerid][0]);
    DestroyObject(Sperre[playerid][1]);
    DestroyObject(Sperre[playerid][2]);
    DestroyObject(Sperre[playerid][3]);
    DestroyObject(Sperre[playerid][4]);
    Sperrebit[playerid]=0;
    Pylonenbit[playerid]=0;
    // Barrierenbit[playerid]=0;
    InCargo[playerid] = 0; InLevi[playerid] = 0; InEnfo[playerid] = 0;
    if(reason == 1)
    {
    if(PlayerCuffed[playerid] >= 1)
    {
    OfflineFlucht[playerid] = 1;
    format(string,sizeof(string),"Warnung %s ist Gefesselt Offline gegangen!(evtl. Offline-Flucht))",sendername);
    ABroadCast(COLOR_YELLOW,string,1);
    //mepmöp
    }
    }
    if(reason == 0)
    {
    if(PlayerCuffed[playerid] >= 1)
    {
    //OfflineFlucht[playerid] = 2;
    format(string,sizeof(string),"Warnung %s hatte gefesselt einen Exe-Crash! Er wird nicht ins Auto-Jail kommen.",sendername);
    ABroadCast(COLOR_YELLOW,string,1);
    //mepmöp
    }
    }
    /*switch(reason)
    {
    case 0://time
    {


    }
    case 1://discon
    {
    if(PlayerCuffed[playerid] >= 1)
    {
    OfflineFlucht[playerid] = 1;
    format(string,sizeof(string),"Warnung %s ist Gefesselt Offline gegangen!(Offline-Flucht))",sendername);
    ABroadCast(COLOR_YELLOW,string,1);
    //mepmöp
    }
    }
    case 2://kick
    {



    }
    }*/
    gActivePlayers[playerid]--;
    numplayers--;
    PlayerInfo[playerid][pAdjustable] = 1;
    PlayerUpdate(playerid);


    GetPlayerName(playerid,sendername,sizeof(sendername));
    format(string,sizeof(string),"%s war nun %d Minuten online! (ID: %d | IP: %s)",sendername,PlayerInfo[playerid][pMinutesSinceLogin],playerid,pIP[playerid]);
    Log("Online.txt",string);


    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(TaxiAccepted[i] < 999)
    {
    if(TaxiAccepted[i] == playerid)
    {
    TaxiAccepted[i] = 999;
    GameTextForPlayer(i, "~w~Kunde~n~~r~Hat das Spiel Verlassen", 5000, 1);
    TaxiCallTime[i] = 0;
    DisablePlayerCheckpoint(i);
    }
    }
    else if(BusAccepted[i] < 999)
    {
    if(BusAccepted[i] == playerid)
    {
    BusAccepted[i] = 999;
    GameTextForPlayer(i, "~w~Kunde~n~~r~Hat Spiel Verlassen", 5000, 1);
    BusCallTime[i] = 0;
    DisablePlayerCheckpoint(i);
    }
    }
    }
    }
    if(GettingCK[playerid] < 999)
    {
    if(IsPlayerConnected(GettingCK[playerid]))
    {
    SendClientMessage(GettingCK[playerid], COLOR_YELLOW, "Dein Abschuss hat den Server verlassen, versuch es später nochmal.");
    OnCK[GettingCK[playerid]] = 999;
    }
    }
    if(TransportCost[playerid] > 0 && TransportDriver[playerid] < 999)
    {
    if(IsPlayerConnected(TransportDriver[playerid]))
    {
    TransportMoney[TransportDriver[playerid]] += TransportCost[playerid];
    TransportTime[TransportDriver[playerid]] = 0;
    TransportCost[TransportDriver[playerid]] = 0;
    format(string, sizeof(string), "~w~Kunde ist ausgestiegen~n~~g~Verdienst: $%d",TransportCost[playerid]);
    GameTextForPlayer(TransportDriver[playerid], string, 5000, 1);
    }
    }
    if(GotHit[playerid] > 0)
    {
    if(GetChased[playerid] < 999)
    {
    if(IsPlayerConnected(GetChased[playerid]))
    {
    SendClientMessage(GetChased[playerid], COLOR_YELLOW, "Er PGR verlassen.");
    GoChase[GetChased[playerid]] = 999;
    }
    }
    }
    if(PlayerPaintballing[playerid] != 0)
    {
    PaintballPlayers --;
    }
    if(PlayerKarting[playerid] > 0 && PlayerInKart[playerid] > 0)
    {
    KartingPlayers --;
    }
    if(PlayersChannel[playerid] < 999)
    {
    IRCInfo[PlayersChannel[playerid]][iPlayers] -= 1;
    }
    if(HireCar[playerid] != 299)
    {
    gLastDriver[HireCar[playerid]] = 300;
    gCarLock[HireCar[playerid]] = 0;
    UnLockCar(HireCar[playerid]);
    }
    if (gLastCar[playerid] > 0)
    {
    gLastDriver[gLastCar[playerid]] = 300;
    if(PlayerInfo[playerid][pPhousekey] != gLastCar[playerid]-1)
    {
    gCarLock[gLastCar[playerid]] = 0;
    UnLockCar(gLastCar[playerid]);
    }
    }
    if(PlayerBoxing[playerid] > 0)
    {
    if(Boxer1 == playerid)
    {
    if(IsPlayerConnected(Boxer2))
    {
    PlayerBoxing[Boxer2] = 0;
    SetPlayerPos(Boxer2, 765.8433,3.2924,1000.7186);
    SetPlayerInterior(Boxer2, 5);
    GameTextForPlayer(Boxer2, "~r~Kampf unterbrochen", 5000, 1);
    }
    }
    else if(Boxer2 == playerid)
    {
    if(IsPlayerConnected(Boxer1))
    {
    PlayerBoxing[Boxer1] = 0;
    SetPlayerPos(Boxer1, 765.8433,3.2924,1000.7186);
    SetPlayerInterior(Boxer1, 5);
    GameTextForPlayer(Boxer1, "~r~Kampf unterbrochen", 5000, 1);
    }
    }
    InRing = 0;
    RoundStarted = 0;
    Boxer1 = 255;
    Boxer2 = 255;
    TBoxer = 255;
    }
    if(TransportDuty[playerid] == 1)
    {
    TaxiDrivers -= 1;
    }
    else if(TransportDuty[playerid] == 2)
    {
    BusDrivers -= 1;
    }
    if(IsPlayerInFrac(playerid, 4))
    {
    if(JobDuty[playerid] == 1)
    {
    Medics -= 1;
    }
    }
    else if(PlayerInfo[playerid][pLeader] == 24 || PlayerInfo[playerid][pMember] == 24)
    {
    if(JobDuty[playerid] == 1) { Mechanics -= 1; }
    }
    if (PlayerInfo[playerid][pRoadblock] != 0)
    {
    RemoveRoadblock(playerid);
    }


    return 1;
    }