OnPlayerConnect Problem

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
  • Hallö,


    ich habe folgendes Problem, immer wenn 40+ Spieler auf dem Server sind funktioniert OnPlayerConnect nicht mehr richtig... und das GUI Fenster zum Einloggen erscheint nichtmehr...


    Ich habe auch schon getestet mit print("Text"); wie weit er ladet jedoch steht dann keins der eingegeben texte... Jedoch werden die Textdraws angezeigt.
    Jedoch habe ich vor und hinter TextDrawShowForPlayer ein "print("-"); gesetzt. Dies mir aber nicht angezeigt wird..


    Hier mein OnPlayerConnect:
    public OnPlayerConnect(playerid)
    {
    gActivePlayers[playerid]++; numplayers++;
    new plname[MAX_PLAYER_NAME], string[35];
    ResetPlayerMoney(playerid); PlayerMoney[playerid] = 0;
    SelectChar[playerid] = 0; fplon[playerid] = 0; SelectCharID[playerid] = 0; SelectCharPlace[playerid] = 0;
    ChosenSkin[playerid] = 0; GuardOffer[playerid] = 999; GuardPrice[playerid] = 0; ApprovedLawyer[playerid] = 0;
    CurrentMoney[playerid] = 0; CP[playerid] = 0; SpawnChange[playerid] = 1; CarOffer[playerid] = 999;
    CarPrice[playerid] = 0; CarID[playerid] = 0; CarCalls[playerid] = 0; MoneyMessage[playerid] = 0; Condom[playerid] = 0;
    STDPlayer[playerid] = 0; SexOffer[playerid] = 999; SexPrice[playerid] = 0; RepairOffer[playerid] = 999;
    RepairPrice[playerid] = 0; RepairCar[playerid] = 0; TalkingLive[playerid] = 255; LiveOffer[playerid] = 999;
    RefillOffer[playerid] = 999; RefillPrice[playerid] = 0; DrugOffer[playerid] = 999; PlayerCuffed[playerid] = 0;
    PlayerCuffedTime[playerid] = 0; DrugPrice[playerid] = 0; DrugGram[playerid] = 0; JailPrice[playerid] = 0;
    GotHit[playerid] = 0; GoChase[playerid] = 999; GetChased[playerid] = 999; PlacedNews[playerid] = 0;
    BoxWaitTime[playerid] = 0; ChangePos2[playerid][1] = 0; SafeTime[playerid] = 60;
    PlayerTied[playerid] = 0; BusCallTime[playerid] = 0; TaxiCallTime[playerid] = 0; MedicCallTime[playerid] = 0;
    MechanicCallTime[playerid] = 0; OrdnungCallTime[playerid] = 0; PolizeiCallTime[playerid] = 0; FindTimePoints[playerid] = 0;
    FindTime[playerid] = 0; Mobile[playerid] = 255; BoxOffer[playerid] = 999; Spectate[playerid] = 255;
    Unspec[playerid][sLocal] = 255; FishCount[playerid] = 0; WritingPaper[playerid] = 0; WritingPaperNumber[playerid] = 999;
    WritingLine[playerid] = 0; BringingPaper[playerid] = 0; GotPaper[playerid] = 0; PaperOffer[playerid] = 999;
    ConsumingMoney[playerid] = 0; gLastCar[playerid] = 0; TicketOffer[playerid] = 999; TicketMoney[playerid] = 0;
    TaxiAccepted[playerid] = 999; BusAccepted[playerid] = 999; HireCar[playerid] = 299;
    TransportValue[playerid] = 0; TransportMoney[playerid] = 0; TransportTime[playerid] = 0; TransportCost[playerid] = 0;
    TransportDriver[playerid] = 999;WatchingTV[playerid] = 0; PlayerPaintballing[playerid] = 0;
    PlayerPaintballKills[playerid] = 0; Fishes[playerid][pLastFish] = 0; Fishes[playerid][pFishID] = 0;
    ProposeOffer[playerid] = 999; MarryWitness[playerid] = 999; MarryWitnessOffer[playerid] = 999; MarriageCeremoney[playerid] = 0; ProposedTo[playerid] = 999; GotProposedBy[playerid] = 999; DivorceOffer[playerid] = 999;
    gPlayerUsingLoopingAnim[playerid] = 0;
    gPlayerAnimLibsPreloaded[playerid] = 0;

    PlayerInfo[playerid][gPupgrade] = 0;
    PlayerInfo[playerid][pExp] = 0;
    PlayerInfo[playerid][pAccount] = 0;
    PlayerInfo[playerid][pCrimes] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pArrested] = 0;
    PlayerInfo[playerid][pWantedDeaths] = 0;
    PlayerInfo[playerid][pLottoNr] = 0;
    PlayerInfo[playerid][pFishes] = 0;
    PlayerInfo[playerid][pBiggestFish] = 0;
    PlayerInfo[playerid][pJob] = 0;
    PlayerInfo[playerid][pPayCheck] = 0;
    PlayerInfo[playerid][pHeadValue] = 0;
    PlayerInfo[playerid][pJailTime] = 0;
    PlayerInfo[playerid][pMats] = 0;
    PlayerInfo[playerid][pDrugs] = 0;
    PlayerInfo[playerid][pHarz] = 0;
    PlayerInfo[playerid][pLeader] = 0;
    PlayerInfo[playerid][pMember] = 0;
    PlayerInfo[playerid][pRank] = 0;
    PlayerInfo[playerid][pContractTime] = 0;
    PlayerInfo[playerid][pDetSkill] = 0;
    PlayerInfo[playerid][pSexSkill] = 0;
    PlayerInfo[playerid][pBoxSkill] = 0;
    PlayerInfo[playerid][pLawSkill] = 0;
    PlayerInfo[playerid][pMechSkill] = 0;
    PlayerInfo[playerid][pJackSkill] = 0;
    PlayerInfo[playerid][pCarSkill] = 0;
    PlayerInfo[playerid][pNewsSkill] = 0;
    PlayerInfo[playerid][pDrugsSkill] = 0;
    PlayerInfo[playerid][pCookSkill] = 0;
    PlayerInfo[playerid][pFishSkill] = 0;
    PlayerInfo[playerid][pSHealth] = 0.0;
    PlayerInfo[playerid][pPos_x] = 2246.6;
    PlayerInfo[playerid][pPos_y] = -1161.9;
    PlayerInfo[playerid][pPos_z] = 1029.7;
    PlayerInfo[playerid][pInt] = 0;
    PlayerInfo[playerid][pLocal] = 255;
    PlayerInfo[playerid][pTeam] = 3;
    PlayerInfo[playerid][pModel] = 137;
    PlayerInfo[playerid][pPnumber] = 0;
    PlayerInfo[playerid][pPhousekey] = 255;
    PlayerInfo[playerid][pPbiskey] = 255;
    PlayerInfo[playerid][pBoatLic] = 0;
    PlayerInfo[playerid][pFishLic] = 0;
    PlayerInfo[playerid][pGunLic] = 0;
    PlayerInfo[playerid][pSFLic] = 0;
    PlayerInfo[playerid][pGun1] = 0;
    PlayerInfo[playerid][pGun2] = 0;
    PlayerInfo[playerid][pGun3] = 0;
    PlayerInfo[playerid][pGun4] = 0;
    PlayerInfo[playerid][pAmmo1] = 0;
    PlayerInfo[playerid][pAmmo2] = 0;
    PlayerInfo[playerid][pAmmo3] = 0;
    PlayerInfo[playerid][pAmmo4] = 0;
    PlayerInfo[playerid][pCarTime] = 0;
    PlayerInfo[playerid][pWins] = 0;
    PlayerInfo[playerid][pLoses] = 0;
    PlayerInfo[playerid][pAlcoholPerk] = 0;
    PlayerInfo[playerid][pDrugPerk] = 0;
    PlayerInfo[playerid][pMiserPerk] = 0;
    PlayerInfo[playerid][pPainPerk] = 0;
    PlayerInfo[playerid][pTraderPerk] = 0;
    PlayerInfo[playerid][pTx] = 0;
    PlayerInfo[playerid][pTy] = 0;
    PlayerInfo[playerid][pTz] = 0;
    ClearCrime(playerid);
    ClearFishes(playerid);
    ClearCooking(playerid);
    ClearGroceries(playerid);
    ClearMarriage(playerid);
    //SHOW
    TextDrawShowForPlayer(playerid, Forum);
    TextDrawShowForPlayer(playerid, Version);
    TextDrawShowForPlayer(playerid, GSF);
    TextDrawShowForPlayer(playerid, Hi);
    //HIDE
    TextDrawHideForPlayer(playerid, Speedo[playerid]);
    TextDrawHideForPlayer(playerid, LevelWar);
    TextDrawHideForPlayer(playerid, CarKauf[playerid]);
    TextDrawHideForPlayer(playerid, TV[playerid]);
    print("1");
    //AUTOHAUS
    dtc_AutohausCar[playerid] = 0;
    dtc_AutohausCat[playerid] = 0;
    dtc_AutohausSCar[playerid] = 0;
    Dtc_PlayerKey[playerid] = 0;
    for(new i = 0; i < MaxVeh; i++)
    {
    Dtc_PlayerHaveCar[playerid][i] = 0;
    }
    OnPlayerCarLogin(playerid);
    print("2");
    SetPlayerColor(playerid,COLOR_GRAD2);
    GetPlayerName(playerid, plname, sizeof(plname));
    format(string, sizeof(string), "/Accounts/%s.ini", plname);
    TogglePlayerSpectating(playerid, 1);
    PlayerSpectateVehicle(playerid, random(15));
    print("3");
    for(new i; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) && i != playerid)
    {
    }
    }
    if(fexist(string))
    {
    new login[128];
    SetPVarInt(playerid, "gPlayerAccount", 1);
    SendClientMessage(playerid, COLOR_BLUE, "[___ Willkommen auf dem Server v"#VERSION" ___]");
    SendClientMessage(playerid, COLOR_WHITE, "Dein Account wurde gefunden, bitte logg dich ein.");
    format(login,128,"Willkommen auf dem Server!\n\nDein Name: %s\n\nBitte gib nun dein Passwort ein!",plname);
    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login",login,"Login","Abbrechen");
    return 1;
    }
    else
    {
    DeletePVar(playerid, "gPlayerAccount");
    SendClientMessage(playerid, COLOR_BLUE, "[___ Willkommen auf dem Server v"#VERSION" ___]");
    SendClientMessage(playerid, COLOR_WHITE, "Du hast noch keinen Account, bitte registrier dich.");
    ShowPlayerDialog(playerid,DIALOG_REG,DIALOG_STYLE_MSGBOX,"Registrieren","Willkommen auf dem Server!\n\nDu hast noch keinen Account!\nRegistriere dich bitte!","Erstellen","Abbrechen");
    return 1;
    }
    }


    Ich kann euch auch noch soviel veraten:
    Die Farbe wird auch nicht gesetzt. Somit sieht man sofort das diese Person einen Login Bug hat.
    Die Farbe ist dann nemlich nicht Grau sondern "SA-MP Standart" ^^


    Ich weiß echt nicht wo dran es liegen könnte , aber vieleicht wisst ihr ja weiter.. :S


    MFG,
    Picaso

  • Setz mal print an den Anfang von OnPlayerConnect, wenn das geht kannste mal an mehreren Stellen printen und gucken in welchem Bereich der Fehler ausgelöst wird. Ich tippe, dass irgentwo bei dir ein Index Out of Bounds ist und der Callback abgebrochen wird.

  • Das Array "PlayerInfo" hat standartmäßig eine größe von "MAX_PLAYERS", dies ist bei mir jedoch nicht auf 500 sondern auf 150 runter definiert. ( In der include Datei geändert^^).


    Aber dadran sollte es eigentlich nicht liegen.....
    naja ich versuch das mal mit dem Print'en^^


    Bisdahin erstmal danke, wer vieleicht noch eine andere idde hat kann sie gerne posten :D



    MFG
    Picaso