Hey,
Ich hab ein Problem!
Ich will ein Regsitersystem haben das über ShowPlayerDialog leuft, sprich ein Fenster wo man sich Einloggen ggf. Registrieren kann, aber das will nicht funktioniren!!
Hier mal meine Cods
new s[128];
new loginname[MAX_PLAYER_NAME];
GetPlayerName(playerid,loginname,MAX_PLAYER_NAME);
format(s,sizeof(s),"Welcome back, %s!\n\nPlease login to continue!",loginname);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login to your account",s,"Login","Cancel");
new string2[64];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), "sAccounts/%s.linux", playername2);
new File: UserFile = fopen(string2, io_read);
if ( UserFile )
{
new PassData[256];
new keytmp[256], valtmp[256];
fread( UserFile , PassData , sizeof( PassData ) );
keytmp = ini_GetKey( PassData );
if( strcmp( keytmp , "Key" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(PlayerInfo[playerid][pKey],password, true ) == 0 )
{
new key[ 256 ] , val[ 256 ];
new Data[ 256 ];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
}
fclose(UserFile);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "SERVER: Falsches Passwort - 4X Falsch = Autoban");
fclose(UserFile);
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 4) { Ban(playerid); }
return 1;
}
if(WantedLevel[playerid] == 1) { WantedPoints[playerid] = 3; }
else if(WantedLevel[playerid] == 2) { WantedPoints[playerid] = 5; }
else if(WantedLevel[playerid] == 3) { WantedPoints[playerid] = 7; }
else if(WantedLevel[playerid] == 4) { WantedPoints[playerid] = 9; }
else if(WantedLevel[playerid] == 5) { WantedPoints[playerid] = 11; }
else if(WantedLevel[playerid] == 6) { WantedPoints[playerid] = 13; }
if(WantedLevel[playerid] < 6) { SetPlayerWantedLevel(playerid,WantedLevel[playerid]); }
else { SetPlayerWantedLevel(playerid,6); }
}
gPlayerLogged[playerid] = 0;
new p[128];
new registername[MAX_PLAYER_NAME];
GetPlayerName(playerid,registername,MAX_PLAYER_NAME);
format(p,sizeof(p),"Welcom, %s!\n\nBitte Registriere dich doch!",registername);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Registriere deinen Account",p,"Register","Cancel");
new string3[64];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), "sAccounts/%.linux", playername3);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
strmid(PlayerInfo[playerid][pKey], password, 0, strlen(password), 255);
new var[32];
format(var, 32, "Key=%s\n", PlayerInfo[playerid][Key]);fwrite(hFile, var);
format(var, 32, "Level=%d\n" , PlayerInfo[playerid][Level]);fwrite(hFile, var);
format(var, 32, "AdminLevel=%d\n", PlayerInfo[playerid][Admin]);fwrite(hFile, var);
fclose(hFile);
}
Hoffe ihr könnt mir helfen.
Dank dir Breadfish das es dich gibt!!