21.12.2012, 17:45
pawn Код:
case DIALOG_LOGIN:
{
if ( !response ) return Kick ( playerid );
if( response )
{
//if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
if(strlen(inputtext) == PInfo[playerid][Password]) {
//if(strcmp(inputtext, PInfo[playerid][Password])) {
new file[64], password2[23], PlayerName[24];
GetPlayerName(playerid,PlayerName,sizeof PlayerName);
format(file,sizeof file,"Admin/%s.ini",PlayerName);
INI_Open(file);//Opening the file with SII include
INI_ReadString(password2,"Password");
PInfo[playerid][Registered] = INI_ReadInt("Registered");
PInfo[playerid][Level] = INI_ReadInt("Level");//Setting the admin level variable, to the one thats in his file.
PInfo[playerid][Score] = INI_ReadInt("Score"); // Setting the score of player
PInfo[playerid][Money] = INI_ReadInt("Money"); // Setting the money of player
PInfo[playerid][Operator] = INI_ReadInt("Operator");
INI_Close();//"Closing the file", that means that we're not using it anymore :P
SendClientMessage(playerid,-1,"You have been successfully logged in!");
PInfo[playerid][Logged] = 1;//Setting the logged in variable to 1
SetPlayerScore(playerid, PInfo[playerid][Score]);
GivePlayerMoney(playerid, PInfo[playerid][Money]);
} else {
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login","You have entered an incorrect password.\nType your password below to login.","Login","Quit");
}
return 1;
}
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case DIALOG_REGISTER: {
if (!response) return Kick(playerid);
if(response) {
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register Below","Wrong Password!\nEnter Password To Play!","Register","Quit");
new file[64], PlayerName[24];
GetPlayerName(playerid,PlayerName,sizeof PlayerName);
format(file,sizeof file,"Admin/%s.ini",PlayerName);
INI_Open(file);
INI_WriteString("Password", inputtext);
INI_WriteInt("Registered",1);
INI_WriteInt("Level",0);
INI_WriteInt("Operator",0);
INI_WriteInt("Score",0);
INI_WriteInt("Money",15000);
INI_Save();
INI_Close();
SendClientMessage(playerid,-1,"You have successfully registered!");
GivePlayerMoney(playerid, 15000); //WHEN YOU LOG OUT IT WILL GET SAVED
PInfo[playerid][Logged] = 1;
PInfo[playerid][Registered] = 1;
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Success!","Your Account Is Now In Our Database! Thanks For Registering","Ok","");
}
}
One: When you register everything saves password etc, but when you login again and you enter your password it says its wrong, and when just click "LOGIN" option with no password filled in it works.
Second: When you register everything saves also, but when i like restart the server you have to reregister and your account gets overwriten...
So when i looked up at the Server_Log i also found something weird:
Код:
---------------------- v0.3e-R2, ©2005-2012 SA-MP Team [18:07:37] password = "" (string) [18:07:37] filterscripts = "" (string)