Hi leude
also.. ich hab ein login GUI system..
ehm.. hab dann ne wilkommensnachricht gemacht und wenn ich mich einlogge - skin wähle .. dann kommt die anchricht - und danch wieder login?
woran liegts?
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\n\nBenutzername: %s\n\nGeben Sie das Passwort ein:",name);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Anmeldung",girismsg,"Anmeldung","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\n\nBenutzername: %s\n\nGeben Sie das Passwort:",playername3);
ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Anmeldung",girismsg,"Anmeldung","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;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 2032.2887,1544.8514,10.8203);
SetPlayerCameraPos(playerid, 2037.3260,1544.8792,10.8203);
SetPlayerCameraLookAt(playerid, 2032.2887,1544.8514,10.8203);
SetPlayerFacingAngle(playerid, 270.0);
new string[128];
if (classid == 0)
{
format(string, sizeof(string), "~y~CJ - Gang : Grooves");
}
if (classid == 1)
{
format(string, sizeof(string), "~y~Folgt");
}
GameTextForPlayer(playerid,string,3500,6);
return 1;
}
public OnPlayerSpawn(playerid)
{
ShowPlayerDialog(playerid,0,DIALOG_STYLE_MSGBOX,"Info:","Dies ist ein Reallife-server!\nBitte achte darauf das du jeden Spieler so behandelst,\nwie du selber behandelt werden willst!\nWenn du nicht weiterkommst ist der befehl /help sehr nützlich!\n\n Viel spaß wünscht das ComaCrew Team:)","Okay","Cancel");
}
public OnPlayerDisconnect(playerid, reason)
{
OnPlayerUpdate(playerid);
AccountInfo[playerid][aLogged] = 0;
register[playerid] = 0;
login[playerid] = 0;
return 1;
}
MfG