[Tutorial] Login and Register System - Dialogs - Using Y_INI

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?
Reply

How to save score?
Reply

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

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

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=/
Reply

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

nice tutorial keep it up
Reply

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

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?
Reply

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

YSI Library from here
Reply

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.
Reply

forum link for Y_ini is dead
Reply

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

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 ^
Reply

Thank you so much +rep
Reply

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!
Reply

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.
Reply

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;
}

Reply

very nice scrip, thats will help for begginers
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)