Hey,
ich habe gerade für meinen Event Server ein Login Register System geschrieben.
Da ich für das Event keine MySQL Datenbank habe, wollte ich das ganze System über dini machen.
Gesagt, getan. Wenn ein Spieler sich nun aber registriert (Geht wunderbar) & dann wieder kommt, muss er sich erneut registrieren obwohl die Date in
Scriptfiles Ordner ist...
Need help
Eigentlich müsse ja hier der Fehler legen unzwar bei OnPlayerConnect, aber das stimmt doch alles, oder?
new pname[MAX_PLAYERS],accFormat[128];
format(accFormat,sizeof accFormat,"/Flash/Accounts/%s.datei",pname);
if(fexist(accFormat))
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,3,"Login","Please enter a password!","Continue","Cancel");
}
else
{
ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please enter your password!","Continue","Cancel");
}
Hier mein OnDialogResponse
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new pname[MAX_PLAYERS],accFormat[128];
GetPlayerName(playerid,pname,sizeof pname);
format(accFormat,sizeof accFormat,"/Flash/Accounts/%s.datei",pname);
if(response){
switch(dialogid){
case DIALOG_LOGIN: {
if(!strlen(inputtext)) {
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please enter your password.","Continue","Cancel");
return
SendClientMessage(playerid,0xFFFFFFFF,"Please enter your password!");
}
if(strcmp(MD5_Hash(inputtext),dini_Get(accFormat,"Passwort")) == 0) {
SpielerInfo[playerid][Tode] = dini_Int(accFormat,"Tode");
SpielerInfo[playerid][TopSielerPlatzID] = dini_Int(accFormat,"TopSielerPlatzID");
SpielerInfo[playerid][admin] = dini_Int(accFormat,"admin");
SpielerInfo[playerid][eingeloggt] = 1;
SendClientMessage(playerid,gruen,"You have been successfully logged in.");
}
else
{
ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please enter your password.","Continue","Cancel");
SendClientMessage(playerid,0xFFFFFFFF,"Bad Password!");
}
}
case DIALOG_REG:
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please enter a password","Continue","Cancel");
return
SendClientMessage(playerid,0xFFFFFFFF,"This password is too short!");
}
dini_Create(accFormat);
dini_Set(accFormat,"Passwort",MD5_Hash(inputtext));
SpielerInfo[playerid][eingeloggt] = 1;
SendClientMessage(playerid,0xFFFFFFFF,"Your account has been created!");
}
}
}
else
{
switch(dialogid)
{
case DIALOG_LOGIN:ShowPlayerDialog(playerid,DIALOG_LOGIN,1,"Login","Please enter your password","Continue","Cancel");
case DIALOG_REG:ShowPlayerDialog(playerid,DIALOG_REG,1,"Register","Please enter a password","Continue","Cancel");
}
}
return 1;
}
Ich danke jetzt schon für die Hilfe.
lg