11.02.2012, 21:43
(
Последний раз редактировалось ReneG; 12.02.2012 в 03:14.
)
Hello, I am trying to make a registration system using dialogs with y_ini following Kush's Y_ini tuorial.
I have no errors when I compile. I have the registration part down, but it's the login part that is messing up somehow. I looked into it more, and I figured out that the password isn't saving correctly. It just shows up as "0" in the User's .ini. which is preventing people from logging in. I have tried numerous times to resolve this problem to no avail. I'm assuming it is something that is right under my nose. Thank you.
Here is my regiser/login part on OnDialogResponse.
Here is my LoadUser_data function
Here is an example of how the .ini file comes out.
Thank you for taking your time to read this.
I have no errors when I compile. I have the registration part down, but it's the login part that is messing up somehow. I looked into it more, and I figured out that the password isn't saving correctly. It just shows up as "0" in the User's .ini. which is preventing people from logging in. I have tried numerous times to resolve this problem to no avail. I'm assuming it is something that is right under my nose. Thank you.
Here is my regiser/login part on OnDialogResponse.
pawn Код:
case 6: //LOGIN
{
if(!response) return Kick(playerid);
if(response)
{
if(udb_hash(inputtext) == pInfo[playerid][pPass])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid,pInfo[playerid][pCash]);
SetSpawnInfo(playerid,0,pInfo[playerid][pSkin],1544.7887,-1675.6476,13.5591,0,0,0,0,0,0,0);
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid,6,DIALOG_STYLE_INPUT,"Login","You have entered an invalid password. \n Type your password below to continue","Login","Quit");
}
return 1;
}
}
case 7: //REGISTER
{
if(!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid,7, DIALOG_STYLE_INPUT,"Registering..."," You have entered an invalid password.","Register","Quit");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Faction",0);
INI_WriteInt(File,"Rank",0);
INI_WriteInt(File,"Leader",0);
INI_WriteInt(File,"Job",0);
INI_WriteInt(File,"Mats",0);
INI_WriteInt(File,"Crack",0);
INI_WriteInt(File,"Bank",20000);
INI_WriteInt(File,"Cash",10000);
INI_WriteInt(File,"HasInvite",0);
INI_WriteInt(File,"CanKill",1);
INI_Close(File);
SetSpawnInfo(playerid,0,0,1544.7887,-1675.6476,13.5591,88.6734, 0, 0, 0, 0, 0,0);
SpawnPlayer(playerid);
GivePlayerMoney(playerid,10000);
pInfo[playerid][pBank] = 20000;
pInfo[playerid][pCash] = GetPlayerMoney(playerid);
pInfo[playerid][pSkin] = GetPlayerSkin(playerid);
}
}
}
return 1;
}
pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Faction",pInfo[playerid][pFaction]);
INI_Int("Rank",pInfo[playerid][pRank]);
INI_Int("Leader",pInfo[playerid][pLeader]);
INI_Int("Job",pInfo[playerid][pJob]);
INI_Int("Mats",pInfo[playerid][pMats]);
INI_Int("Crack",pInfo[playerid][pCrack]);
INI_Int("Bank",pInfo[playerid][pBank]);
INI_Int("Cash",pInfo[playerid][pCash]);
INI_Int("HasInvite",pInfo[playerid][pHasInvite]);
INI_Int("Password",pInfo[playerid][pPass]);
INI_Int("IsDead",pInfo[playerid][pIsDead]);
INI_Int("CanKill",pInfo[playerid][pCanKill]);
INI_Int("Skin",pInfo[playerid][pSkin]);
return 1;
}
Код:
[data] Password = 0 Faction = 0 Rank = 0 Leader = 0 Job = 0 Mats = 0 Crack = 0 Bank = 20000 Cash = 10000 HasInvite = 0 CanKill = 0 Skin = 0