SA-MP Forums Archive
[Tutorial] Login and Register System - Dialogs - Using Y_INI - 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)
+---- Forum: Tutorials (https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Login and Register System - Dialogs - Using Y_INI (/showthread.php?tid=273088)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14


Re: Login and Register System - Dialogs - Using Y_INI - dimashr12345 - 01.09.2015

For some reason the player file is not even created. I haven't changed anything in the FS, and I have created the folder where the files should be saved. Can anyone help me with this issue?


Re: Login and Register System - Dialogs - Using Y_INI - AndreiWow - 04.09.2015

How to save score?


Re: Login and Register System - Dialogs - Using Y_INI - DownDuckling - 12.09.2015

How would I go about and convert this script to eINI (https://sampforum.blast.hk/showthread.php?tid=573490) I'm quite confused. Thanks


Re: Login and Register System - Dialogs - Using Y_INI - GlorifiedPig - 16.11.2015

When it saves, my data file creates but it has nothing inside of it, it's a blank file.


Re: Login and Register System - Dialogs - Using Y_INI - GlorifiedPig - 17.11.2015

Quote:
Originally Posted by dimashr12345
View Post
For some reason the player file is not even created. I haven't changed anything in the FS, and I have created the folder where the files should be saved. Can anyone help me with this issue?
Did you put it in scriptfiles?
I also had that problem but then I put it in scriptfiles but now it doesn't save info=/


Re: Login and Register System - Dialogs - Using Y_INI - Markhoss - 06.01.2016

I tried it and nothing happened when I connected to the server


Re: Login and Register System - Dialogs - Using Y_INI - salaheddine - 07.01.2016

nice tutorial keep it up


Re: Login and Register System - Dialogs - Using Y_INI - Joron - 17.01.2016

Good... but kindah sucks i had a major problem when i first used this.


Re: Login and Register System - Dialogs - Using Y_INI - Cylano - 19.02.2016

Just wondering. Is there a way to stop files being saved if a password isn't set? If I login with 'username' but log out without setting a password, the user file is created, but cannot be used. The problem is, this takes up a username. How do I fix it?


Re: Login and Register System - Dialogs - Using Y_INI - Dejan12345 - 18.07.2016

dont work i dont know from where download yini page you give can load it deleted


Re: Login and Register System - Dialogs - Using Y_INI - iKarim - 18.07.2016

YSI Library from here


Re: Login and Register System - Dialogs - Using Y_INI - Mitchyjones - 04.08.2016

It doesn't seem to save anything when I relog, whys this? Do you have a fix for it?

I'll be monitoring this more often.


Re: Login and Register System - Dialogs - Using Y_INI - Oracle1997 - 04.08.2016

forum link for Y_ini is dead


Re: Login and Register System - Dialogs - Using Y_INI - Stinged - 04.08.2016

Quote:
Originally Posted by Oracle1997
View Post
forum link for Y_ini is dead
Check the post above the post above you.


Re: Login and Register System - Dialogs - Using Y_INI - Mitchyjones - 05.08.2016

Quote:
Originally Posted by Mitchyjones
View Post
It doesn't seem to save anything when I relog, whys this? Do you have a fix for it?

I'll be monitoring this more often.
Still waiting ^


Re: Login and Register System - Dialogs - Using Y_INI - Gorgeousmaniac - 21.08.2016

Thank you so much +rep


Re: Login and Register System - Dialogs - Using Y_INI - AvicennaRabama - 09.12.2016

I did all of the step that guided. But, look at this. I don't know why, Can anyone give the reason why is this? And the way for fix it?
Code:
E:\samp037_svr_R2-1-1_win32\gamemodes\new.pwn(107) : error 001: expected token: "-string end-", but found "-identifier-"
E:\samp037_svr_R2-1-1_win32\gamemodes\new.pwn(107) : error 001: expected token: "-string end-", but found "-identifier-"
E:\samp037_svr_R2-1-1_win32\gamemodes\new.pwn(107) : warning 215: expression has no effect
E:\samp037_svr_R2-1-1_win32\gamemodes\new.pwn(107) : error 001: expected token: ";", but found "-integer value-"
E:\samp037_svr_R2-1-1_win32\gamemodes\new.pwn(107) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Thanks!


Re: Login and Register System - Dialogs - Using Y_INI - FreakyTeddyKiller - 30.03.2017

Now, I've fixed that problem so I'm having a new damn problem and that is:

G:\GTA SA MODS\samp037_svr_R2-1-1_win32\pawno\include\YSI/y_ini.inc(162) : fatal error 100: cannot read from file: "internal\y_version"
1 Error.


Re: Login and Register System - Dialogs - Using Y_INI - KizZweLL - 03.04.2017

The script is good, but when i try to register and /q then login it says that the password is incorrect.
how to fix this?

Quote:

//include
#include <a_samp>
#include <YSI\y_ini>
#include <sscanf2>
//PATH
#define PATH "/Users/%s.ini"
//colors
#define White "{FFFFFF}"
#define Red "{FF0000}"
//DIALOG
#define LOGIN 1
#define REGISTER 2
#define SUCCESS 3
//enum
enum Info
{
Password,
Admin,
Cash,
Kills,
Deaths,
Score,
Color,
}
new PlayerInfo[MAX_PLAYERS][Info];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][Password]);
INI_Int("Admin",PlayerInfo[playerid][Admin]);
INI_Int("Cash",PlayerInfo[playerid][Cash]);
INI_Int("Kills",PlayerInfo[playerid][Kills]);
INI_Int("Deaths",PlayerInfo[playerid][Deaths]);
INI_Int("Score",PlayerInfo[playerid][Score]);
INI_Int("Color",PlayerInfo[playerid][Color]);
return 1;
}
//stock
stock UserPath(playerid)
{
new string[128],Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,sizeof(Name));
format(string,sizeof(string),PATH,Name);
return string;
}
stock GetName(playerid)
{
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid,Name,MAX_PLAYER_NAME);
return Name;
}
stock udb_hash(buf[]) {
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
public OnPlayerConnect(playerid)
{
if(fexist(UserPath(playerid)))
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "{FFFFFF}LOGIN...", "{FFFFFF}Please Enter Your Password Below to Login.", "Login", "");
}
else
{
ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "{FFFFFF}REGISTER...", "{FFFFFF}Please Enter Password To Register.", "Register", "");
}
return 1;
}
public OnPlayerDisconnect(playerid,reason)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Stats");
INI_WriteInt(File,"Admin",PlayerInfo[playerid][Admin]);
INI_WriteInt(File,"Cash",PlayerInfo[playerid][Cash]);
INI_WriteInt(File,"Kills",PlayerInfo[playerid][Kills]);
INI_WriteInt(File,"Deaths",PlayerInfo[playerid][Deaths]);
INI_WriteInt(File,"Score",PlayerInfo[playerid][Score]);
INI_WriteInt(File,"Color",PlayerInfo[playerid][Color]);
INI_Close(File);
INI_Close(File);
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
switch( dialogid )
{
case REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "{FFFFFF}REGISTER...", "{FFFFFF}Please Enter Password To Register.", "Register", "");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"Stats");
INI_WriteInt(File,"Password",udb_hash(inputtext));
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Color",0);
INI_Close(File);
ShowPlayerDialog(playerid, SUCCESS, DIALOG_STYLE_MSGBOX, "{00FF00}Success!!!", "{FF61FF}You Have Successfully Registered!", "Okay", ""); INI_Close(File);
SpawnPlayer(playerid);
}
}

case LOGIN:
{
if (!response) return Kick ( playerid );
if(response)
{
if(udb_hash(inputtext) == PlayerInfo[playerid][Password])
{
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
GivePlayerMoney(playerid, PlayerInfo[playerid][Cash]);
SetPlayerVirtualWorld(playerid,0);
SetPlayerInterior(playerid,0);
SetPlayerScore(playerid,PlayerInfo[playerid][Score]);
ShowPlayerDialog(playerid, SUCCESS, DIALOG_STYLE_MSGBOX, "{00FF00}Success!!!", "{FF61FF}You Have Successfully Logged in!", "Okay", "");
}
else
{
ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login!", "{FF0000}You Have Entered An Invalid Password\n{FF0000}Please Re-enter Your Password Below.", "Okay", "");
}
return 1;
}
}
}
return 1;
}




Re: Login and Register System - Dialogs - Using Y_INI - ShaharG - 27.04.2017

very nice scrip, thats will help for begginers