regi/login sys verbuggt hilfe

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 erstmal ich habe ein problem mit meinem selfmade script beim login / register system undzwar wenn ich mich neu regi und einlogge klappt alles aber wenn ich in der ini des spielers etwas editiere (nicht beim passwort editiere ich) und mich einloggen will steht da falsches passwort ich bitte um hilfe danke


  • OnPlayerConnect
    GetPlayerName(playerid, playrname, sizeof(playrname));
    format(connect, sizeof(connect), "%s.ini", playrname);
    if(fexist(connect))
    {
    gPlayerAccount[playerid] = 1;
    SendClientMessage(playerid, COLOR_YELLOW, "Du bist Registriert logge dich mit /login <Passwort> ein");
    return 1;
    }
    else
    {
    gPlayerAccount[playerid] = 0;
    SendClientMessage(playerid, COLOR_YELLOW, "Bitte Registrier dich mit /register <Passwort>");
    }
    PlayerInfo[playerid][pAutoschein] = 0;
    PlayerInfo[playerid][pMotorradschein] = 0;
    PlayerInfo[playerid][pBootschein] = 0;
    PlayerInfo[playerid][pFlugschein] = 0;
    PlayerInfo[playerid][pWaffenschein] = 0;
    PlayerInfo[playerid][pAdmin] = 0;
    PlayerInfo[playerid][pWarns] = 0;
    PlayerInfo[playerid][pGetoetet] = 0;
    PlayerInfo[playerid][pGestorben] = 0;
    GivePlayerMoney(playerid,PlayerInfo[playerid][pGeld]);

    OnPlayerCommandText
    if (strcmp(cmd, "/login", true) ==0 )
    {
    if(IsPlayerConnected(playerid))
    {
    new tmppass[64];
    if(gPlayerLogged[playerid] == 1)
    {
    SendClientMessage(playerid, COLOR_GREY, "Du bist bereits eingeloggt.");
    return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GREY, " Benutze: /login [Passwort]");
    return 1;
    }
    strmid(tmppass, tmp, 0, strlen(cmdtext), 255);
    Encrypt(tmppass);
    OnPlayerLogin(playerid,tmppass);
    }
    return 1;
    }
    if (strcmp(cmd, "/register", true)==0)
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GREY, "Benutze: /register [Passwort]");
    return 1;
    }
    if (gPlayerAccount[playerid] == 1)
    {
    SendClientMessage(playerid, COLOR_GREY, "Du bist bereits Registriert");
    return 1;
    }
    strmid(PlayerInfo[playerid][pPassword], tmp, 0, strlen(cmdtext), 255);
    Encrypt(PlayerInfo[playerid][pPassword]);
    GetPlayerName(playerid, playername, sizeof(playername));
    format(string, sizeof(string), "%s.ini", playername);
    new File: file = fopen(string, io_read);
    if (file)
    {
    SendClientMessage(playerid, COLOR_GREY, "Du bist bereits Registriert");
    fclose(file);
    return 1;
    }
    new File:hFile;
    hFile = fopen(string, io_append);
    new var[32];//
    format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
    format(var, 32, "Getötet=%d\n",PlayerInfo[playerid][pGetoetet]);fwrite(hFile, var);
    format(var, 32, "Gestorben=%d\n",PlayerInfo[playerid][pGestorben]);fwrite(hFile, var);
    PlayerInfo[playerid][pGeld] = GetPlayerMoney(playerid);
    format(var, 32, "Autoschein=%d\n",PlayerInfo[playerid][pAutoschein]);fwrite(hFile, var);
    format(var, 32, "Geld=%d\n",PlayerInfo[playerid][pGeld]);fwrite(hFile, var);
    format(var, 32, "Motorradschein=%d\n",PlayerInfo[playerid][pMotorradschein]);fwrite(hFile, var);
    format(var, 32, "Bootschein=%d\n",PlayerInfo[playerid][pBootschein]);fwrite(hFile, var);
    format(var, 32, "Flugschein=%d\n",PlayerInfo[playerid][pFlugschein]);fwrite(hFile, var);
    format(var, 32, "Waffenschein=%d\n",PlayerInfo[playerid][pWaffenschein]);fwrite(hFile, var);
    format(var, 32, "Admin=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
    format(var, 32, "Warnungen=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);
    fclose(hFile);
    SendClientMessage(playerid, COLOR_WHITE, "Erfolgreich Registriert!");
    SendClientMessage(playerid, COLOR_WHITE, "Nächstes mal benutze /login <Passwort> zum Einloggen.");
    OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
    return 1;
    }

    OnPlayerLogin
    new pname2[MAX_PLAYER_NAME];
    new pname3[MAX_PLAYER_NAME];
    new string2[64];
    new string3[128];
    GetPlayerName(playerid, pname2, sizeof(pname2));
    format(string2, sizeof(string2), "%s.ini", pname2);
    new File: UserFile = fopen(string2, io_read);
    if (UserFile)
    {
    new valtmp[128];
    fread(UserFile, valtmp);strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);
    if ((strcmp(PlayerInfo[playerid][pPassword], string, true, strlen(valtmp)-1) == 0))
    {
    new key[128],val[128];
    new Data[128];
    while(fread(UserFile,Data,sizeof(Data)))
    {
    key = ini_GetKey(Data);
    if( strcmp( key , "Getötet" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGetoetet] = strval( val ); }
    if( strcmp( key , "Gestorben" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGestorben] = strval( val ); }
    if( strcmp( key , "Waffenschein" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWaffenschein] = strval( val ); }
    if( strcmp( key , "Motorradschein" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMotorradschein] = strval( val ); }
    if( strcmp( key , "Bootschein" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBootschein] = strval( val ); }
    if( strcmp( key , "Waffenschein" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWaffenschein] = strval( val ); }
    if( strcmp( key , "Flugschein" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFlugschein] = strval( val ); }
    if( strcmp( key , "Autoschein" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAutoschein] = strval( val ); }
    if( strcmp( key , "Geld" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGeld] = strval( val ); }
    if( strcmp( key , "Admin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
    if( strcmp( key , "Warnungen" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarns] = strval( val ); }
    GivePlayerMoney(playerid,PlayerInfo[playerid][pGeld]);
    }
    fclose(UserFile);
    gPlayerLogged[playerid] = 1;
    gPlayerAccount[playerid] = 1;
    ResetPlayerMoney(playerid);
    GivePlayerMoney(playerid,PlayerInfo[playerid][pGeld]);
    new kills = PlayerInfo[playerid][pGetoetet];
    SetPlayerScore(playerid, kills);
    GetPlayerName(playerid, pname3, sizeof(pname3));
    format(string3, sizeof(string3), "Willkommen %s, du hast dich erfolgreich eingeloggt!", pname3);
    SendClientMessage(playerid, COLOR_WHITE,string3);
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, "Das angegebene Passwort stimmt nicht");
    fclose(UserFile);
    }
    }
    return 1;
    }

    OnPlayerUpdate
    {
    if(IsPlayerConnected(playerid))
    {
    if(gPlayerLogged[playerid])
    {
    new string3[32];
    new pname3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname3, sizeof(pname3));
    format(string3, sizeof(string3), "%s.ini", pname3);
    new File: pFile = fopen(string3, io_write);
    if (pFile)
    {
    new var[32];
    format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(pFile, var);
    fclose(pFile);
    new File: hFile = fopen(string3, io_append);
    PlayerInfo[playerid][pGeld] = GetPlayerMoney(playerid);
    format(var, 32, "Getötet=%d\n",PlayerInfo[playerid][pGetoetet]);fwrite(hFile, var);
    format(var, 32, "Gestorben=%d\n",PlayerInfo[playerid][pGestorben]);fwrite(hFile, var);
    format(var, 32, "Geld=%d\n",PlayerInfo[playerid][pGeld]);fwrite(hFile, var);
    format(var, 32, "Autoschein=%d\n",PlayerInfo[playerid][pAutoschein]);fwrite(hFile, var);
    format(var, 32, "Motorradschein=%d\n",PlayerInfo[playerid][pMotorradschein]);fwrite(hFile, var);
    format(var, 32, "Bootschein=%d\n",PlayerInfo[playerid][pBootschein]);fwrite(hFile, var);
    format(var, 32, "Waffenschein=%d\n",PlayerInfo[playerid][pWaffenschein]);fwrite(hFile, var);
    format(var, 32, "Flugschein=%d\n",PlayerInfo[playerid][pFlugschein]);fwrite(hFile, var);
    format(var, 32, "Admin=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
    format(var, 32, "Warnungen=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);
    fclose(hFile);
    }
    }
    }
    return 1;
    }

    OnPlayerRegister
    {
    if(IsPlayerConnected(playerid))
    {
    new string3[32];
    new playername3[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername3, sizeof(playername3));
    format(string3, sizeof(string3), "%s.ini", playername3);
    new File: hFile = fopen(string3, io_write);
    if (hFile)
    {
    PlayerInfo[playerid][pGeld] = GetPlayerMoney(playerid);
    strmid(PlayerInfo[playerid][pPassword], password, 0, strlen(password), 255);
    new var[32];
    format(var, 32, "Passwort=%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
    format(var, 32, "Getötet=%d\n",PlayerInfo[playerid][pGetoetet]);fwrite(hFile, var);
    format(var, 32, "Gestorben=%d\n",PlayerInfo[playerid][pGestorben]);fwrite(hFile, var);
    format(var, 32, "Autoschein=%d\n",PlayerInfo[playerid][pAutoschein]);fwrite(hFile, var);
    format(var, 32, "Motorradschein=%d\n",PlayerInfo[playerid][pMotorradschein]);fwrite(hFile, var);
    format(var, 32, "Bootschein=%d\n",PlayerInfo[playerid][pBootschein]);fwrite(hFile, var);
    format(var, 32, "Waffenschein=%d\n",PlayerInfo[playerid][pWaffenschein]);fwrite(hFile, var);
    format(var, 32, "Flugschein=%d\n",PlayerInfo[playerid][pFlugschein]);fwrite(hFile, var);
    format(var, 32, "Geld=%d\n",PlayerInfo[playerid][pGeld]);fwrite(hFile, var);
    format(var, 32, "Admin=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
    format(var, 32, "Warnungen=%d\n",PlayerInfo[playerid][pWarns]);fwrite(hFile, var);
    fclose(hFile);
    SendClientMessage(playerid, COLOR_YELLOW, "Account registriert, du kannst dich nun einloggen mit /login [Passwort]).");
    }
    }
    return 1;
    }

  • Keine ahnung, ich glaube das Passwort wird in der .ini verschlüsselt. bin mir aber nicht sicher, wen du das änderst, dan musste du das richtige passwort finden, den in der ini ist ja nur die verschlüsselung, bin mir aber nicht sicher !