[Tutorial] Login/Register system [YINI+Whirlpool]
#32

Codes where it went wrong:

Code:
public OnPlayerDisconnect(playerid, reason)
{
    //Same as OnDialogResponse, we will save their stats inside of their user's account
    if(fexist(Path(playerid)))//Will check if the file is exit or not inside of User's folder that we have created.
    {
        new INI:file = INI_Open(Path(playerid)); //will open their file
        INI_SetTag(file,"Player's Data");//We will set a tag inside of user's account called "Player's Data"
        INI_WriteInt(file,"AdminLevel",pInfo[playerid][Adminlevel]); //If you've set his/her admin level, then his/her admin level will be saved inside of his/her account
        INI_WriteInt(file,"VIPLevel",pInfo[playerid][VIPlevel]);//As explained above
        INI_WriteInt(file,"Money",GetPlayerMoney(playerid));//We will save his money inside of his account
        INI_WriteInt(file,"Scores",GetPlayerScore(playerid));//We will save his score inside of his account
        INI_WriteInt(file,"Kills",pInfo[playerid][Kills]);//As explained above
        INI_WriteInt(file,"Deaths",pInfo[playerid][Deaths]);//As explained above
        INI_Close(file);//Now after we've done saving their data, we now need to close the file
        return 1;
    }
    return 1;
}
Code:
public OnPlayerConnect(playerid)
{
    new name[MAX_PLAYER_NAME]; //Making a new variable called 'name'. name[MAX_PLAYER_NAME] is created so we can use it to get player's name.
    GetPlayerName(playerid,name,sizeof(name)); //Get player's name
    if(fexist(Path(playerid))) /* Check if the connected user is registered or not. fexist stands for file exist. So if file exist in the files(Path(playerid)),*/
    {// then
        INI_ParseFile(Path(playerid),"loadaccount_%s", .bExtra = true, .extra = playerid); //Will load user's data using INI_Parsefile.
        ShowPlayerDialog(playerid,dlogin,DIALOG_STYLE_INPUT,"Login Mate","Welcome back to Thug Life RolePlay!. This account is registered. \nInsert your password to login to your account","Login","Quit :(");/*A dialog with input style will appear so you can insert your password to login.*/
    }
    else //If the connected user is not registered,
    {//then we will 'force' him to register :)
        ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register Mate","Welcome to Thug Life RolePlay! This account is not registered.\nEnter your own password to create a new account.","Register","Quit :(");
        return 1;
    }
    return 1;
}
Reply


Messages In This Thread
Login/Register system [YINI+Whirlpool] - by newbienoob - 20.06.2012, 20:03
Re: Login/Register system [YINI+Whirlpool] - by Mr.Fames - 20.06.2012, 20:46
Re: Login/Register system [YINI+Whirlpool] - by Mimic - 20.06.2012, 20:53
Re: Login/Register system [YINI+Whirlpool] - by Mr.Fames - 21.06.2012, 06:01
Re: Login/Register system [YINI+Whirlpool] - by SkL_MD - 21.06.2012, 06:04
Re: Login/Register system [YINI+Whirlpool] - by newbienoob - 21.06.2012, 08:05
Re: Login/Register system [YINI+Whirlpool] - by Mimic - 21.06.2012, 12:41
Re: Login/Register system [YINI+Whirlpool] - by newbienoob - 21.06.2012, 13:22
Re: Login/Register system [YINI+Whirlpool] - by Jonny5 - 21.06.2012, 13:29
Re: Login/Register system [YINI+Whirlpool] - by ReneG - 21.06.2012, 14:18
Re: Login/Register system [YINI+Whirlpool] - by newbienoob - 21.06.2012, 15:19
Re: Login/Register system [YINI+Whirlpool] - by Nicholas. - 21.06.2012, 20:52
Re: Login/Register system [YINI+Whirlpool] - by JustinAn - 22.06.2012, 01:45
Re: Login/Register system [YINI+Whirlpool] - by newbienoob - 22.06.2012, 03:23
Re: Login/Register system [YINI+Whirlpool] - by Dziugsas - 22.06.2012, 08:42
Re: Login/Register system [YINI+Whirlpool] - by Rg-Gaming.Info - 22.06.2012, 12:57
Re: Login/Register system [YINI+Whirlpool] - by JustinAn - 23.06.2012, 02:03
Re: Login/Register system [YINI+Whirlpool] - by Littlehelper - 23.06.2012, 02:57
Re: Login/Register system [YINI+Whirlpool] - by Ukko - 24.06.2012, 14:12
Re: Login/Register system [YINI+Whirlpool] - by newbienoob - 24.06.2012, 14:26
Re: Login/Register system [YINI+Whirlpool] - by Ukko - 24.06.2012, 14:34
Re: Login/Register system [YINI+Whirlpool] - by Littlehelper - 24.06.2012, 15:09
Re: Login/Register system [YINI+Whirlpool] - by newbienoob - 24.06.2012, 15:27
Re: Login/Register system [YINI+Whirlpool] - by CoDeZ - 04.07.2012, 13:31
Re: Login/Register system [YINI+Whirlpool] - by Avi57 - 04.07.2012, 15:23
Re: Login/Register system [YINI+Whirlpool] - by Jonny5 - 04.07.2012, 18:19
Re: Login/Register system [YINI+Whirlpool] - by misho1 - 15.07.2012, 21:15
Re: Login/Register system [YINI+Whirlpool] - by $$inSane - 19.07.2012, 16:31
Re: Re : Login/Register system [YINI+Whirlpool] - by FireCat - 27.07.2012, 20:58
Re: Login/Register system [YINI+Whirlpool] - by mwoww77 - 08.08.2012, 11:24
Re: Login/Register system [YINI+Whirlpool] - by Weaselpwns - 12.08.2012, 08:14
Re: Login/Register system [YINI+Whirlpool] - by Weaselpwns - 12.08.2012, 08:18
Re: Login/Register system [YINI+Whirlpool] - by sidney123 - 15.08.2012, 22:11
Re: Login/Register system [YINI+Whirlpool] - by PaYkOK - 17.08.2012, 15:10
Re: Login/Register system [YINI+Whirlpool] - by MarkoN - 21.08.2012, 00:22
Re: Login/Register system [YINI+Whirlpool] - by Glint - 05.09.2012, 11:15
Re: Login/Register system [YINI+Whirlpool] - by Gangster-rocks - 17.09.2012, 10:04
Re: Login/Register system [YINI+Whirlpool] - by Qu3esL - 17.09.2012, 11:00
Re: Login/Register system [YINI+Whirlpool] - by basse - 30.09.2012, 02:32
Re: Login/Register system [YINI+Whirlpool] - by newbienoob - 30.09.2012, 03:00
Re: Login/Register system [YINI+Whirlpool] - by Joey_euber - 20.06.2014, 16:42
Re: Login/Register system [YINI+Whirlpool] - by Le3aT - 08.07.2014, 10:07
Re: Login/Register system [YINI+Whirlpool] - by GuyYahood1 - 25.01.2018, 17:45

Forum Jump:


Users browsing this thread: 1 Guest(s)