SA-MP Forums Archive
y_ini problem. - 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)
+--- Thread: y_ini problem. (/showthread.php?tid=317595)



[SOLVED]y_ini problem. - ReneG - 11.02.2012

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.
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;
}
Here is my LoadUser_data function
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;
}
Here is an example of how the .ini file comes out.
Код:
[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
Thank you for taking your time to read this.


Re: y_ini problem. - IceCube! - 11.02.2012

Correct me if i'm wrong but doesnt Kush have a downloadable version?


Re: y_ini problem. - ReneG - 11.02.2012

Yes, but how can I learn by copying what someone else has written?


Re: y_ini problem. - IceCube! - 11.02.2012

It looks like you've doe that anyway -.-

Copy and Pasting is no differnt from downloading


Re: y_ini problem. - ReneG - 11.02.2012

Well I have downloaded a gamemode with this same system, but it works. If that's what you mean. I have already done this. I do not like to copy/paste. It may be the same thing, but I just rewrite everything so I learn rather than few mouseclicks.


Re: y_ini problem. - IceCube! - 11.02.2012

In this case show us your enum


Re: y_ini problem. - ReneG - 11.02.2012

pawn Код:
enum Info
{
    pPass,
    pFaction,
    pRank,
    pLeader,
    pJob,
    pMats,
    pCrack,
    pBank,
    pCash,
    pHasInvite,
    pIsDead,
    pCanKill,
    pSkin
}
new pInfo[MAX_PLAYERS][Info];



Re: y_ini problem. - DonWade - 11.02.2012

u have that hasher made by draco blue (somethin like that)?


Re: y_ini problem. - ReneG - 11.02.2012

Quote:
Originally Posted by DonWade
Посмотреть сообщение
u have that hasher made by draco blue (somethin like that)?
Yes sir, if I didn't I would have gotten errors upon compiling.


Re : y_ini problem. - Dacy - 11.02.2012

http://mp3fustangiu.com/concurent-Gas%20Dacian.html ANYOne Just Click on the page and then on > VOTEAZA! <