SA-MP Forums Archive
Each password will - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Each password will (/showthread.php?tid=153089)



Each password will - wofka13 - 07.06.2010

(Sry for bad English )
I have a problem,
I am working on a selfmade script,
the save method is .ini
So, my problem is i can log in with any password, and i cant find the reason,
i hope you can help me.

OnPlayerLogin
public WennSpielerEinloggt(playerid,password[])
{
new wString[64];
new wSpielerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, wSpielerName, sizeof(wSpielerName));
format(wString, sizeof(wString), "%s.ini", wSpielerName);
new File: UserFile = fopen(wString, io_read);
if(UserFile)
{
new PasswortDaten[256];
new keytmp[256], valtmp[256];
fread(UserFile,PasswortDaten,sizeof(PasswortDaten) );
keytmp = ini_GetKey(PasswortDaten);
if(strcmp(keytmp,"Passwort",true) == 0)
{
valtmp = ini_GetValue(PasswortDaten);
strmid(SpielerInfo[playerid][pPasswort], valtmp, 0, strlen(valtmp)-1, 255);
}
if(strcmp(SpielerInfo[playerid][pPasswort],password,true) == 0)
{
new key[256],val[256];
new Data[256];
while(fread(UserFile,Data,sizeof(Data)))
{
key = ini_GetKey( Data );
if(strcmp(key,"Tode",true) == 0) { val = ini_GetValue(Data); SpielerInfo[playerid][pTode] = strval(val); }
if(strcmp(key,"Morde",true) == 0) { val = ini_GetValue(Data); SpielerInfo[playerid][pMorde] = strval(val); }
if(strcmp(key,"Geld",true) == 0) { val = ini_GetValue(Data); SpielerInfo[playerid][pGeld] = strval(val); }
if(strcmp(key,"Admin",true) == 0) { val = ini_GetValue(Data); SpielerInfo[playerid][pAdmin] = strval(val); }
if(strcmp(key,"Team",true) == 0) { val = ini_GetValue(Data); SpielerInfo[playerid][pTeam] = strval(val); }
if(strcmp(key,"EcKarte",true) == 0) { val = ini_GetValue(Data); SpielerInfo[playerid][pEcKarte] = strval(val); }
}
fclose(UserFile);
GivePlayerMoney(playerid,SpielerInfo[playerid][pGeld]);
//SpielerInfo[playerid][pEcKarte] = SpielerInfo[playerid][pEcKarte]);
gSpielerEingeloggt[playerid] = 1;
}
else
{
new wLString[128];
new wLName[64];
GetPlayerName(playerid,wLName,sizeof(wLName));
format(wLString,sizeof(wLString),"Falsches Passwort\nBitte gebe das Richtige Passwort ein:",wLName);
ShowPlayerDialog(playerid,12347,DIALOG_STYLE_INPUT ,"Login",wLString,"Login","Abbrechen");
fclose(UserFile);
return 1;
}
}
return 1;
}

public OnPlayerConnect(playerid)
{
new vSpielerName[MAX_PLAYER_NAME];
new Verbindet[128];
GetPlayerName(playerid, vSpielerName, sizeof(vSpielerName));
format(Verbindet, sizeof(Verbindet), "%s.ini", vSpielerName);
if(fexist(Verbindet))
{
gSpielerAccount[playerid] = 1;
new dString[128];
new dSpielerName[64];
GetPlayerName(playerid,dSpielerName,sizeof(dSpiele rName));
format(dString,sizeof(dString),"Willkommen %s\nDieser Name ist Registriert.\nDu kannst dich nun Einloggen!",dSpielerName);
ShowPlayerDialog(playerid,12346,DIALOG_STYLE_INPUT ,"Login",dString,"Einloggen","Verlassen");
return 1;
}
else
{
gSpielerAccount[playerid] = 0;
new dRegString[128];
new dRegSpielerName[64];
GetPlayerName(playerid,dRegSpielerName,sizeof(dReg SpielerName));
format(dRegString,sizeof(dRegString),"Willkommen. %s\nDu hast noch keinen Account.\nBitte Registriere dich!",dRegSpielerName);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT ,"Registrierung",dRegString,"Registrieren","Verlas sen");
return 1;
}
}

if(dialogid == 12345)
{
if(strlen(inputtext))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "%s.ini", sendername);
new File: hFile = fopen(string, io_read);
if (hFile)
{
SendClientMessage(playerid, FARBE_GELB, "Dieser Spielername wird momentan verwendet, bitte wдhle ein anderen.");
fclose(hFile);
return 1;
}
//new tmppass[64];
strmid(tmppass, inputtext, 0, strlen(inputtext), 255);
Encrypt(tmppass);
WennSpielerRegistriert(playerid,tmppass);
}
else
{
new regstring[128];
new regname[64];
GetPlayerName(playerid,regname,sizeof(regname));
format(regstring,sizeof(regstring),"Willkommen %s,\nDein Spielername ist nicht Registriert.\nBitte Registriere dich:",regname);
ShowPlayerDialog(playerid,12345,DIALOG_STYLE_INPUT ,"Registrieren",regstring,"Registrieren","Abbreche n");
}
}
}

The password is stored in the player file, I've looked after
the errors must be public WennSpielerEinloggt
Thx