Probleme mit Spielergeld

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


    Wenn ich online komme/andere Spieler, haben sie plötzlich einen Betrag von sagen wir -22k, wenn sie relogen, dann haben sie -44k, dann -88k und so weiter..... Ich weiss nicht, woran das liegen könnte.


    public OnPlayerConnect(playerid)
    {
    Angebot[0][playerid] = 0;
    Angebot[1][playerid] = 0;
    Angebot[2][playerid] = 0;
    Angebot[3][playerid] = 0;
    Angebot[4][playerid] = 0;
    Angebot[5][playerid] = 0;
    Angebot[6][playerid] = 0;
    Angebot[7][playerid] = 0;
    Angebot[8][playerid] = 0;
    PlayerAngebot[0][playerid] = 0;
    PlayerAngebot[1][playerid] = 0;
    PlayerAngebot[2][playerid] = 0;
    PlayerAngebot[3][playerid] = 0;
    PlayerAngebot[4][playerid] = 0;
    WaffenDeal[0][playerid] = 0;
    WaffenDeal[1][playerid] = 0;
    WaffenDeal[2][playerid] = 0;
    WaffenDeal[3][playerid] = 0;
    TAuftrag[0][playerid] = 0;
    TAuftrag[1][playerid] = 0;
    TAuftrag[2][playerid] = 0;
    TAuftrag[3][playerid] = 0;
    TAuftrag[4][playerid] = 0;
    TAuftrag[5][playerid] = 0;
    TAuftrag[6][playerid] = 0;
    TAuftrag[7][playerid] = 0;
    TAuftrag[8][playerid] = 0;
    FAuftrag[0][playerid] = 0;
    FAuftrag[1][playerid] = 0;
    FAuftrag[2][playerid] = 0;
    FAuftrag[3][playerid] = 0;
    HAuftrag[0][playerid] = 0;
    HAuftrag[1][playerid] = 0;
    HAuftrag[2][playerid] = 0;
    HAuftrag[3][playerid] = 0;
    DAuftrag[0][playerid] = 0;
    DAuftrag[1][playerid] = 0;
    DAuftrag[2][playerid] = 0;
    DAuftrag[3][playerid] = 0;
    Pizza[0][playerid] = 0;
    Pizza[1][playerid] = 0;
    Pizza[2][playerid] = 0;
    Eis[0][playerid] = 0;
    Eis[1][playerid] = 0;
    Eis[2][playerid] = 0;
    Hotdog[0][playerid] = 0;
    Hotdog[1][playerid] = 0;
    Hotdog[2][playerid] = 0;
    SetPlayerColor(playerid, COLOR_GREY);
    if(IsPlayerNPC(playerid))
    {
    gPlayerAccount[playerid] = 1;
    gPlayerLogged[playerid] = 1;
    return 1;
    }
    else
    {
    SetPlayerCameraPos(playerid, -2668.5005, 1420.0167, 912.4063);
    SetPlayerCameraLookAt(playerid, -2666.1284, 1423.0178, 912.4063);
    new string[256]; format(string, sizeof(string), "%s betritt den Server",ReadName(playerid));
    SendClientMessageToAll(COLOR_YELLOW2, string);
    ServerLog(string);
    PlayerInfo[playerid][pKills] = 0; PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pCash] = 0; PlayerInfo[playerid][pBank] = 0;
    PlayerInfo[playerid][pTeam] = 0; PlayerInfo[playerid][pLeader] = 0;
    PlayerInfo[playerid][pMember] = 0; PlayerInfo[playerid][pRank] = 1;
    PlayerInfo[playerid][pAdmin] = 0; PlayerInfo[playerid][pSkin] = 0;
    PlayerInfo[playerid][pFSkin] = 0; PlayerInfo[playerid][pLevel] = 0;
    PlayerInfo[playerid][pKnastzeit] = 0; PlayerInfo[playerid][pKnast] = 0;
    PlayerInfo[playerid][pJailed] = 0; PlayerInfo[playerid][pJPoints] = 0;
    PlayerInfo[playerid][pFPoints] = 0; PlayerInfo[playerid][pWanteds] = 0;
    PlayerInfo[playerid][pDrogen] = 0; PlayerInfo[playerid][pTelefonnummer] = 0;
    PlayerInfo[playerid][pTelefon] = 0; PlayerInfo[playerid][pTelefonstatus] = 0;
    PlayerInfo[playerid][pTelefonbatterie] = 0; PlayerInfo[playerid][pTelefonabo] = 0;
    PlayerInfo[playerid][pTelefonbuch] = 0; PlayerInfo[playerid][pTelefonladegeraet] = 0;
    PlayerInfo[playerid][pAutoLiz] = 0; PlayerInfo[playerid][pBikeLiz] = 0;
    PlayerInfo[playerid][pFlugLiz] = 0; PlayerInfo[playerid][pWaffLiz] = 0;
    PlayerInfo[playerid][pAnglLiz] = 0; PlayerInfo[playerid][pBootLiz] = 0;
    PlayerInfo[playerid][pLKWLiz] = 0; PlayerInfo[playerid][pKopfgeld] = 0;
    PlayerInfo[playerid][pOpfer] = 999; PlayerInfo[playerid][pAuftrag] = 0;
    PlayerInfo[playerid][pMacher] = 999; PlayerInfo[playerid][pKey] = 1;
    PlayerInfo[playerid][pJob] = 0; PlayerInfo[playerid][pDrinkingCount] = 0;
    PlayerInfo[playerid][pDrinkingType] = 0; PlayerInfo[playerid][pFAnzahl] = 0;
    PlayerInfo[playerid][pKennzeichen1] = 0; PlayerInfo[playerid][pKennzeichen2] = 0;
    PlayerInfo[playerid][pInCar] = 0; PlayerInfo[playerid][pHAnzahl] = 0;
    PlayerInfo[playerid][pAngelroute] = 0; PlayerInfo[playerid][pFisch] = 0;
    PlayerInfo[playerid][pTutorial] = 0;
    Woof[playerid] = -1; WooX[playerid] = -1;
    SetPlayerCameraPos(playerid, -2668.5005, 1420.0167, 912.4063);
    SetPlayerCameraLookAt(playerid, -2666.1284, 1423.0178, 912.4063);
    new mat[256]; format(mat, sizeof(mat),"/Spieler/%s.cer",ReadName(playerid));
    if(!fexist(mat))
    {
    gPlayerAccount[playerid] = 0;
    JB_GivePlayerMoney(playerid, (START_CASH/2));
    PlayerInfo[playerid][pBank] = START_BANK;
    PlayerInfo[playerid][pTeam] = 0;
    PlayerInfo[playerid][pLeader] = 0;
    PlayerInfo[playerid][pMember] = 0;
    PlayerInfo[playerid][pRank] = 1;
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pSkin] = 0;
    PlayerInfo[playerid][pFSkin] = 0;
    PlayerInfo[playerid][pLevel] = 1;
    SendClientMessage(playerid, COLOR_WHITE, " ");
    SendClientMessage(playerid, COLOR_YELLOW2, "Du hast noch keinen Account. Bitte fülle folgendes aus:");
    new s[128];
    format(s,sizeof(s),"Wilkommen %s!\n\nTippe hier dein Passwort ein:",ReadName(playerid));
    ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Register Fenster",s,"Registrieren","Abbrechen");
    }
    else
    {
    gPlayerAccount[playerid] = 1;
    SendClientMessage(playerid, COLOR_WHITE, " ");
    SendClientMessage(playerid, COLOR_YELLOW2, "Du hast bereits einen Account. Bitte tippe dein Passwort ein:");
    new s[128];
    format(s,sizeof(s),"Wilkommen %s!\n\nTippe hier dein Passwort ein:",ReadName(playerid));
    ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Login Fenster",s,"Einloggen","Abbrechen");
    }
    }


    PlayerProps[playerid] = 0;
    Logged[playerid] = 0;
    EarningsForPlayer[playerid] = 0;
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
    for(new propid; propid < PropertiesAmount; propid++)
    {
    if(PropInfo[propid][PropIsBought] == 1)
    {
    if(strcmp(PropInfo[propid][PropOwner], pName, true)==0)
    {
    EarningsForPlayer[playerid] += PropInfo[propid][PropEarning];
    PlayerProps[playerid]++;
    }
    }
    }
    if(PlayerProps[playerid] > 0)
    {
    new str[128];
    format(str, 128, "Du besitzt momentan %d Business. Gebe für Infos darüber /biz ein", PlayerProps[playerid]);
    SendClientMessage(playerid, COLOR_GREEN, str);
    }
    return 1;
    }


    Hier das OnPlayerUpdate, welches den aktuellen Geldstand ausliesst und in pCash abspeichert.


    PlayerInfo[playerid][pCash] = JB_GetPlayerMoney(playerid);


    MfG dUDA

  • Versteh das Problem nicht, warum sollten die unterschiedlich werden? Verwende doch einfach eine gemeinsame Funktion die gleichzeitig den angezeigten Wert (PlayerMoney) und deine Variable setzt.


    Wenn du die mMn beste Variante - bei Login auslesen, bei Logout abspeichern - nicht magst, müsstest du jedes Mal auf die File zugreifen sobald sich der Wert ändert.

    GameMode / Filterscript / Plugin Development via
    - PAWN / C/C++
    - Database (mySQL) & Filebased - Systems


    Webdevelopment / Interfaces Webapplications - SA:MP Server via
    - HTML & CSS
    - PHP, JavaScript, Ajax