Login Dialog
#1

Fixed
Reply
#2

look at this:


Код:
new file[256];
     new password[256];
     password = dini_Get(file, "password");
you created string file, but... where is file path? Where you saving to string file path to file?
Reply
#3

This isent saving the pass, it's retriving it.

This is for the login dialog.


Whole OnDialgoResponce

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if((dialogid == 1) && (response == 1))
	{
	  new playername[24], str[128];
		GetPlayerName(playerid, playername, sizeof(playername));
		format(str, sizeof(str), "%s.ini", playername);
		dini_Create(str);
		dini_Set(str,"password",inputtext);
		dini_IntSet(str,"Rank",PlayerInfo[playerid][pRank]);
		dini_IntSet(str,"Reborn=",PlayerInfo[playerid][pReborn]);
		dini_IntSet(str,"Exp", 0);
		dini_IntSet(str,"van", PlayerInfo[playerid][pVan]);
		dini_IntSet(str,"Kills", 0);
		dini_IntSet(str,"TKills", PlayerInfo[playerid][pTKills]);
		dini_IntSet(str,"GrenadeKills", 0);
		dini_IntSet(str,"Mp5Kills", 0);
		dini_IntSet(str,"KnuckleKills",0);
		dini_IntSet(str,"MenuGoal", 0);
		dini_IntSet(str,"HeliGoal", 0);
		dini_IntSet(str,"Armourgoal", PlayerInfo[playerid][pArmourgoal]);
		dini_IntSet(str,"Mapgoal", PlayerInfo[playerid][pMapgoal]);
		dini_IntSet(str,"Deaths", 0);
		dini_IntSet(str,"Admin", 0);
		dini_IntSet(str,"GM", 0);
		dini_IntSet(str,"Premium",0);
		dini_IntSet(str,"Money", PlayerInfo[playerid][pCash]);
		SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
		SendClientMessage(playerid, COLOR_WHITE, "Don't forget your password!.");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}
	if((dialogid == 2) && (response == 1))
		{
    new tmp[128];
 		new file[256];
    new password[256];
		password = dini_Get(file, "password");
		new pName[24];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(file, sizeof(file), "%s.ini", pName);
		new tmppass[64];
		strmid(tmppass, tmp, 0, strlen(inputtext), 255);
		if(udb_hash(inputtext) == udb_hash(password))
		{
			OnPlayerLogin(playerid,tmppass);
		}
		else
		{
			ShowPlayerDialog(playerid, 2,1,"Wrong Password", "That Password was not correct.\nPlease try again, or change your name.","Login","cancel");
		}
		return 1;
	}
	if((dialogid == 2) && (response == 0))
	{
		SendClientMessage(playerid, COLOR_RED, "You must log in to use this server");
		Kick(playerid);
 	}
 	return 1;
}
Reply
#4

Quote:
Originally Posted by jamesb93
This isent saving the pass, it's retriving it.

This is for the login dialog.


Whole OnDialgoResponce

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if((dialogid == 1) && (response == 1))
	{
	  new playername[24], str[128];
		GetPlayerName(playerid, playername, sizeof(playername));
		format(str, sizeof(str), "%s.ini", playername);
		dini_Create(str);
		dini_Set(str,"password",inputtext);
		dini_IntSet(str,"Rank",PlayerInfo[playerid][pRank]);
		dini_IntSet(str,"Reborn=",PlayerInfo[playerid][pReborn]);
		dini_IntSet(str,"Exp", 0);
		dini_IntSet(str,"van", PlayerInfo[playerid][pVan]);
		dini_IntSet(str,"Kills", 0);
		dini_IntSet(str,"TKills", PlayerInfo[playerid][pTKills]);
		dini_IntSet(str,"GrenadeKills", 0);
		dini_IntSet(str,"Mp5Kills", 0);
		dini_IntSet(str,"KnuckleKills",0);
		dini_IntSet(str,"MenuGoal", 0);
		dini_IntSet(str,"HeliGoal", 0);
		dini_IntSet(str,"Armourgoal", PlayerInfo[playerid][pArmourgoal]);
		dini_IntSet(str,"Mapgoal", PlayerInfo[playerid][pMapgoal]);
		dini_IntSet(str,"Deaths", 0);
		dini_IntSet(str,"Admin", 0);
		dini_IntSet(str,"GM", 0);
		dini_IntSet(str,"Premium",0);
		dini_IntSet(str,"Money", PlayerInfo[playerid][pCash]);
		SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
		SendClientMessage(playerid, COLOR_WHITE, "Don't forget your password!.");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}
	if((dialogid == 2) && (response == 1))
		{
    new tmp[128];
 		new file[256];
    new password[256];
		password = dini_Get(file, "password");
		new pName[24];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(file, sizeof(file), "%s.ini", pName);
		new tmppass[64];
		strmid(tmppass, tmp, 0, strlen(inputtext), 255);
		if(udb_hash(inputtext) == udb_hash(password))
		{
			OnPlayerLogin(playerid,tmppass);
		}
		else
		{
			ShowPlayerDialog(playerid, 2,1,"Wrong Password", "That Password was not correct.\nPlease try again, or change your name.","Login","cancel");
		}
		return 1;
	}
	if((dialogid == 2) && (response == 0))
	{
		SendClientMessage(playerid, COLOR_RED, "You must log in to use this server");
		Kick(playerid);
 	}
 	return 1;
}
You didin't understood DjHard:

You have
new file[256];
and then
password = dini_Get(file, "password");
but you need one more thing:
new file[256];
file = "Directory/To/The.File";
....
password = dini_Get(file, "password");

Something like that..
Reply
#5

In still having troubles with it:

I'm still getting "Wrong password"
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if((dialogid == 1) && (response == 1))
	{
	  new playername[24], str[128];
		GetPlayerName(playerid, playername, sizeof(playername));
		format(str, sizeof(str), "%s.ini", playername);
		dini_Create(str);
		dini_Set(str,"password",inputtext);
		dini_IntSet(str,"Rank",PlayerInfo[playerid][pRank]);
		dini_IntSet(str,"Reborn=",PlayerInfo[playerid][pReborn]);
		dini_IntSet(str,"Exp", 0);
		dini_IntSet(str,"van", PlayerInfo[playerid][pVan]);
		dini_IntSet(str,"Kills", 0);
		dini_IntSet(str,"TKills", PlayerInfo[playerid][pTKills]);
		dini_IntSet(str,"GrenadeKills", 0);
		dini_IntSet(str,"Mp5Kills", 0);
		dini_IntSet(str,"KnuckleKills",0);
		dini_IntSet(str,"MenuGoal", 0);
		dini_IntSet(str,"HeliGoal", 0);
		dini_IntSet(str,"Armourgoal", PlayerInfo[playerid][pArmourgoal]);
		dini_IntSet(str,"Mapgoal", PlayerInfo[playerid][pMapgoal]);
		dini_IntSet(str,"Deaths", 0);
		dini_IntSet(str,"Admin", 0);
		dini_IntSet(str,"GM", 0);
		dini_IntSet(str,"Premium",0);
		dini_IntSet(str,"Money", PlayerInfo[playerid][pCash]);
		SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
		SendClientMessage(playerid, COLOR_WHITE, "Don't forget your password!.");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}
	if((dialogid == 2) && (response == 1))
		{
    new tmp[128];
 		new file[256];
    new password[256];
    file = dini_Get("scriptfiles/%.ini", password);
		password = dini_Get(file, "password");
		new pName[24];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(file, sizeof(file), "%s.ini", pName);
		new tmppass[64];
		strmid(tmppass, tmp, 0, strlen(inputtext), 255);
		if(udb_hash(inputtext) == udb_hash(password))
		{
			OnPlayerLogin(playerid,tmppass);
		}
		else
		{
			ShowPlayerDialog(playerid, 2,1,"Wrong Password", "That Password was not correct.\nPlease try again, or change your name.","Login","cancel");
		}
		return 1;
	}
	if((dialogid == 2) && (response == 0))
	{
		SendClientMessage(playerid, COLOR_RED, "You must log in to use this server");
		Kick(playerid);
 	}
 	return 1;
}
Reply
#6

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if((dialogid == 1) && (response == 1))
	{
	  new playername[24], str[128];
		GetPlayerName(playerid, playername, sizeof(playername));
		format(str, sizeof(str), "%s.ini", playername);
		dini_Create(str);
		dini_Set(str,"password",inputtext);
		dini_IntSet(str,"Rank",PlayerInfo[playerid][pRank]);
		dini_IntSet(str,"Reborn=",PlayerInfo[playerid][pReborn]);
		dini_IntSet(str,"Exp", 0);
		dini_IntSet(str,"van", PlayerInfo[playerid][pVan]);
		dini_IntSet(str,"Kills", 0);
		dini_IntSet(str,"TKills", PlayerInfo[playerid][pTKills]);
		dini_IntSet(str,"GrenadeKills", 0);
		dini_IntSet(str,"Mp5Kills", 0);
		dini_IntSet(str,"KnuckleKills",0);
		dini_IntSet(str,"MenuGoal", 0);
		dini_IntSet(str,"HeliGoal", 0);
		dini_IntSet(str,"Armourgoal", PlayerInfo[playerid][pArmourgoal]);
		dini_IntSet(str,"Mapgoal", PlayerInfo[playerid][pMapgoal]);
		dini_IntSet(str,"Deaths", 0);
		dini_IntSet(str,"Admin", 0);
		dini_IntSet(str,"GM", 0);
		dini_IntSet(str,"Premium",0);
		dini_IntSet(str,"Money", PlayerInfo[playerid][pCash]);
		SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
		SendClientMessage(playerid, COLOR_WHITE, "Don't forget your password!.");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}
	if((dialogid == 2) && (response == 1))
		{
    new tmp[128];
 		new file[256];
    new password[256];
    file = "scriptfiles/%.ini";
		password = dini_Get(file, "password");
		new pName[24];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(file, sizeof(file), "%s.ini", pName);
		new tmppass[64];
		strmid(tmppass, tmp, 0, strlen(inputtext), 255);
		if(udb_hash(inputtext) == udb_hash(password))
		{
			OnPlayerLogin(playerid,tmppass);
		}
		else
		{
			ShowPlayerDialog(playerid, 2,1,"Wrong Password", "That Password was not correct.\nPlease try again, or change your name.","Login","cancel");
		}
		return 1;
	}
	if((dialogid == 2) && (response == 0))
	{
		SendClientMessage(playerid, COLOR_RED, "You must log in to use this server");
		Kick(playerid);
 	}
 	return 1;
}
[/quote]
Reply
#7

Quote:
Originally Posted by darkrider366
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	if((dialogid == 1) && (response == 1))
	{
	  new playername[24], str[128];
		GetPlayerName(playerid, playername, sizeof(playername));
		format(str, sizeof(str), "%s.ini", playername);
		dini_Create(str);
		dini_Set(str,"password",inputtext);
		dini_IntSet(str,"Rank",PlayerInfo[playerid][pRank]);
		dini_IntSet(str,"Reborn=",PlayerInfo[playerid][pReborn]);
		dini_IntSet(str,"Exp", 0);
		dini_IntSet(str,"van", PlayerInfo[playerid][pVan]);
		dini_IntSet(str,"Kills", 0);
		dini_IntSet(str,"TKills", PlayerInfo[playerid][pTKills]);
		dini_IntSet(str,"GrenadeKills", 0);
		dini_IntSet(str,"Mp5Kills", 0);
		dini_IntSet(str,"KnuckleKills",0);
		dini_IntSet(str,"MenuGoal", 0);
		dini_IntSet(str,"HeliGoal", 0);
		dini_IntSet(str,"Armourgoal", PlayerInfo[playerid][pArmourgoal]);
		dini_IntSet(str,"Mapgoal", PlayerInfo[playerid][pMapgoal]);
		dini_IntSet(str,"Deaths", 0);
		dini_IntSet(str,"Admin", 0);
		dini_IntSet(str,"GM", 0);
		dini_IntSet(str,"Premium",0);
		dini_IntSet(str,"Money", PlayerInfo[playerid][pCash]);
		SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
		SendClientMessage(playerid, COLOR_WHITE, "Don't forget your password!.");
		OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
		return 1;
	}
	if((dialogid == 2) && (response == 1))
		{
    new tmp[128];
 		new file[256];
    new password[256];
    file = "scriptfiles/%.ini";
		password = dini_Get(file, "password");
		new pName[24];
		GetPlayerName(playerid, pName, sizeof(pName));
		format(file, sizeof(file), "%s.ini", pName);
		new tmppass[64];
		strmid(tmppass, tmp, 0, strlen(inputtext), 255);
		if(udb_hash(inputtext) == udb_hash(password))
		{
			OnPlayerLogin(playerid,tmppass);
		}
		else
		{
			ShowPlayerDialog(playerid, 2,1,"Wrong Password", "That Password was not correct.\nPlease try again, or change your name.","Login","cancel");
		}
		return 1;
	}
	if((dialogid == 2) && (response == 0))
	{
		SendClientMessage(playerid, COLOR_RED, "You must log in to use this server");
		Kick(playerid);
 	}
 	return 1;
}
[/quote]


What? lol
Reply
#8

bump
Reply
#9

Try replacing your public OnDialogResponse to this one:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    new playername[24], str[128];
    GetPlayerName(playerid, playername, sizeof(playername));
    format(str, sizeof(str), "%s.ini", playername);
    if((dialogid == 1) && (response == 1))
    {
        dini_Create(str);
        dini_Set(str,"password",inputtext);
        dini_IntSet(str,"Rank",PlayerInfo[playerid][pRank]);
        dini_IntSet(str,"Reborn=",PlayerInfo[playerid][pReborn]);
        dini_IntSet(str,"Exp", 0);
        dini_IntSet(str,"van", PlayerInfo[playerid][pVan]);
        dini_IntSet(str,"Kills", 0);
        dini_IntSet(str,"TKills", PlayerInfo[playerid][pTKills]);
        dini_IntSet(str,"GrenadeKills", 0);
        dini_IntSet(str,"Mp5Kills", 0);
        dini_IntSet(str,"KnuckleKills",0);
        dini_IntSet(str,"MenuGoal", 0);
        dini_IntSet(str,"HeliGoal", 0);
        dini_IntSet(str,"Armourgoal", PlayerInfo[playerid][pArmourgoal]);
        dini_IntSet(str,"Mapgoal", PlayerInfo[playerid][pMapgoal]);
        dini_IntSet(str,"Deaths", 0);
        dini_IntSet(str,"Admin", 0);
        dini_IntSet(str,"GM", 0);
        dini_IntSet(str,"Premium",0);
        dini_IntSet(str,"Money", PlayerInfo[playerid][pCash]);
        SendClientMessage(playerid, COLOR_WHITE, "Succesfully Registered!");
        SendClientMessage(playerid, COLOR_WHITE, "Don't forget your password!.");
        OnPlayerLogin(playerid,PlayerInfo[playerid][pPassword]);
        return 1;
    }
    if((dialogid == 2) && (response == 1))
        {
    new tmp[128];
    new password[256];
        password = dini_Get(str, "password");
        new tmppass[64];
        strmid(tmppass, tmp, 0, strlen(inputtext), 255);
        if(udb_hash(inputtext) == udb_hash(password))
        {
            OnPlayerLogin(playerid,tmppass);
        }
        else
        {
            ShowPlayerDialog(playerid, 2,1,"Wrong Password", "That Password was not correct.\nPlease try again, or change your name.","Login","cancel");
        }
        return 1;
    }
    if((dialogid == 2) && (response == 0))
    {
        SendClientMessage(playerid, COLOR_RED, "You must log in to use this server");
        Kick(playerid);
    }
    return 1;
}
EDIT:
I think, your problem was this:
pawn Код:
if((dialogid == 2) && (response == 1))
        {
    new tmp[128];
        new file[256];
    new password[256];
        password = dini_Get(file, "password"); // LINE - *
        new pName[24]; // THIS LINE SHOULD GO AFTER THE LINE "new password[256];"
        GetPlayerName(playerid, pName, sizeof(pName)); // THIS LINE SHOULD GO AFTER THE LINE "new password[256];"
        format(file, sizeof(file), "%s.ini", pName); // THIS LINE SHOULD GO B E F O R E THE LINE I'VE MARKED AS *
//.......
Reply
#10

**Fixed**

Thanks to SiJ
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)