Problem beim Auslesen des Admin ranks

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
  • Ich habe ien schwerwigendes Problem an dem ich seid einer Stunde verzweifel irgendwie liest mein Login befehl alles auf nur nicht den Admin rang und ich finde den fehler nicht poste mal gesamten playerfile teil:



    public OnPlayerRegister(playerid,password[])
    {
    if(IsPlayerConnected(playerid) && !gLogged[playerid])
    {
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Player/%s.ini", name);
    new File: hFile = fopen(str, io_write);
    if (hFile)
    {
    strmid(PlayerInfo[playerid][pPass], password, 0, strlen(password), 255);
    new var[32];
    new varp[128];
    format(var, 32, "Admin=0\n");fwrite(hFile, var);
    format(varp, 128, "Pass=%s\n",PlayerInfo[playerid][pPass]);fwrite(hFile, varp);
    format(var, 32, "Level=1\n");fwrite(hFile, var);
    format(var, 32, "Exp=0\n");fwrite(hFile, var);
    format(var, 32, "Cash=%d\n",StartMoney);fwrite(hFile, var);
    format(var, 32, "Tut=0\n");fwrite(hFile, var);
    format(var, 32, "Spawn=0\n");fwrite(hFile, var);
    format(var, 32, "CarModel=0\n");fwrite(hFile, var);
    format(var, 32, "CarPrice=0\n");fwrite(hFile, var);
    format(var, 32, "CarC1=0\n");fwrite(hFile, var);
    format(var, 32, "CarC2=0\n");fwrite(hFile, var);
    fclose(hFile);
    }
    }
    }


    public OnPlayerLogin(playerid,password[])
    {
    new tmp2[128];
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    format(string2, sizeof(string2), "/Player/%s.ini", playername2);
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
    new PassData[128];
    new keytmp[128], valtmp[128];
    fread( UserFile , PassData , sizeof( PassData ) );
    keytmp = ini_GetKey( PassData );
    if( strcmp( keytmp , "Key" , true ) == 0 )
    {
    valtmp = ini_GetValue( PassData );
    strmid(PlayerInfo[playerid][pPass], valtmp, 0, strlen(valtmp)-1, 255);
    }
    if(strcmp(PlayerInfo[playerid][pPass],password, true ) == 0 )
    {
    new key[ 128 ] , val[ 128 ];
    new Data[ 128 ];
    while ( fread( UserFile , Data , sizeof( Data ) ) )
    {
    key = ini_GetKey( Data );
    if( strcmp( key , "Admin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); } //HIER MUSS DER FEHLER SEIN
    if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
    if( strcmp( key , "Exp" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
    if( strcmp( key , "Cash" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
    GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]);
    if( strcmp( key , "Tut" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTut] = strval( val ); }
    if( strcmp( key , "Spawn" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawn] = strval( val ); }
    if( strcmp( key , "CarModel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarModel] = strval( val ); }
    if( strcmp( key , "CarPrice" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarPrice] = strval( val ); }
    if( strcmp( key , "CarC1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarC1] = strval( val ); }
    if( strcmp( key , "CarC2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarC2] = strval( val ); }
    }
    fclose(UserFile);
    gLogged[playerid] = 1;
    SpawnPlayer(playerid);
    format(tmp2, sizeof(tmp2), "~w~Willkommen ~n~~y~ %s", playername2);
    GameTextForPlayer(playerid, tmp2, 5000, 1);
    SetPlayerVirtualWorld(playerid, 0);
    }
    else
    {
    SendClientMessage(playerid, C_WHITE, "SERVER: Password ist falsch.");
    fclose(UserFile);
    gPlayerLogTries[playerid] += 1;
    if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
    }
    }
    }

    public OnPlayerAccUpdate(playerid)
    {
    if(IsPlayerConnected(playerid) && gLogged[playerid])
    {
    new name[MAX_PLAYER_NAME], str[128];
    GetPlayerName(playerid, name, sizeof name);
    format(str, sizeof str, "/Player/%s.ini", name);
    new File: hFile = fopen(str, io_write);
    if (hFile)
    {
    new var[32];
    new varp[128];
    format(var, 32, "Admin=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
    format(varp, 128, "Pass=%s\n",PlayerInfo[playerid][pPass]);fwrite(hFile, varp);
    format(var, 32, "Level=%d\n",PlayerInfo[playerid][pLevel]);fwrite(hFile, var);
    format(var, 32, "Exp=%d\n",PlayerInfo[playerid][pExp]);fwrite(hFile, var);
    format(var, 32, "Cash=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
    format(var, 32, "Tut=%d\n",PlayerInfo[playerid][pTut]);fwrite(hFile, var);
    format(var, 32, "Spawn=%d\n",PlayerInfo[playerid][pSpawn]);fwrite(hFile, var);
    format(var, 32, "CarModel=%d\n",PlayerInfo[playerid][pCarModel]);fwrite(hFile, var);
    format(var, 32, "CarPrice=%d\n",PlayerInfo[playerid][pCarPrice]);fwrite(hFile, var);
    format(var, 32, "CarC1=%d\n",PlayerInfo[playerid][pCarC1]);fwrite(hFile, var);
    format(var, 32, "CarC2=%d\n",PlayerInfo[playerid][pCarC2]);fwrite(hFile, var);
    fclose(hFile);
    }
    }
    }