achso okay ;D
ehm jaa, ins login system (GUI system)
public OnPlayerConnect(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new string[128];
format(string, sizeof(string), ACCOUNTS_FOLDER, name);
if (AccountInfo[playerid][aLogged] == 0)
{
if (!fexist(string))
{
new kayitmsg[256];
format(kayitmsg,256,"Willkommen\n\n%s bitte öffnen Sie ein neues Konto\n\nNeues Passwort eingeben:",name);
ShowPlayerDialog(playerid,0,DIALOG_STYLE_INPUT,"Registrieren",kayitmsg,"Registrieren"," Abbrechen");
register[playerid] = 1;
login[playerid] = 0;
}
else if (fexist(string))
{
new girismsg[256];
format(girismsg,256,"Willkommen bei der ComaCrew\n\nBenutzername: %s\n\nBitte geben Sie ihr password ein:",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Abbrechen");
register[playerid] = 0;
login[playerid] = 1;
}
}
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if (response == 1)
{
if(dialogid == 0)
{
Encrypt(inputtext);
new player[MAX_PLAYER_NAME];
GetPlayerName(playerid, player, 50);
new string3[32];
new playername3[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername3, sizeof(playername3));
format(string3, sizeof(string3), ACCOUNTS_FOLDER, playername3);
new ip[20];
GetPlayerIp(playerid,ip,sizeof(ip));
new File: hFile = fopen(string3, io_write);
if (hFile)
{
strmid(AccountInfo[playerid][aPasswort], inputtext, 0, strlen(inputtext), 255);
new var[128];
format(var, 128, "Passwort=%s\n", AccountInfo[playerid][aPasswort]);fwrite(hFile, var);
format(var, 128, "IP=%s\n",ip);fwrite(hFile, var);
fclose(hFile);
printf("%s is signed up.",playername3);
SendClientMessage(playerid, GREEN, "|- Die Registrierung war erfolgreich. Du kannst dich jetzt einloggen. -|");
GivePlayerMoney(playerid,50000);
new girismsg[256];
format(girismsg,256,"Willkommen bei der ComaCrew\n\nBenutzername: %s\n\nBitte geben Sie ihr password ein:",playername3);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Login",girismsg,"Login","Abbrechen");
register[playerid] = 0;
login[playerid] = 1;
}
}
if(dialogid == 1)
{
Encrypt(inputtext);
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), ACCOUNTS_FOLDER, 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 , "Passwort" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(AccountInfo[playerid][aPasswort], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(AccountInfo[playerid][aPasswort],inputtext, true ) == 0 )
{
for(new p = 0; p < strlen(AccountInfo[playerid][aPasswort]); p++)
{
inputtext[p] = '?';
}
SetTimerEx("LogIn", LOGIN_DELAY*1000, 0, "d", playerid);
printf("%s is logged in.",playername2);
new key[256] , val[256];
new Data[256];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
}
fclose(UserFile);
}
else
{
new girismsg[256];
printf("%s falsches Passwort verwendet wurde.",playername2);
format(girismsg,256,"FALSCHES PASSWORT\n\nGeben Sie das Passwort:");
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Anmeldung",girismsg,"Anmeldung","Abbrechen");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
}
if(dialogid == 2)
{
Encrypt(inputtext);
new string2[128];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
format(string2, sizeof(string2), ACCOUNTS_FOLDER, 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 , "Passwort" , true ) == 0 )
{
valtmp = ini_GetValue( PassData );
strmid(AccountInfo[playerid][aPasswort], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(AccountInfo[playerid][aPasswort],inputtext, true ) == 0 )
{
for(new p = 0; p < strlen(AccountInfo[playerid][aPasswort]); p++)
{
inputtext[p] = '?';
}
SetTimerEx("LogIn", LOGIN_DELAY*1000, 0, "d", playerid);
printf("%s is logged in.",playername2);
new key[256] , val[256];
new Data[256];
while ( fread( UserFile , Data , sizeof( Data ) ) )
{
key = ini_GetKey( Data );
}
fclose(UserFile);
}
else
{
new girismsg[256];
printf("%s falsches Passwort verwendet wurde.",playername2);
format(girismsg,256,"FALSCHES PASSWORT\n\nGeben Sie das Passwort:");
ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Anmeldung",girismsg,"Anmeldung","Abbrechen");
login[playerid] = 1;
register[playerid] = 0;
fclose(UserFile);
return 1;
}
}
}
}
else return Kick(playerid);
return 0;
}
MfG