Y_ini bugs , Password is not showing ++Rep
#1

In the Users file , the password and the Admin lvl are supposed to show up , but the admin lvl is not there and the password is shown as 0 , this system is exactly coppied from a tut , i dont have the link tho

stats:
Код:
[data]
Cash = 0
Score = 0
Kills = 0
Password = 0
Deaths = 0
RectionTests = 0
Moneybags = 0
Warned = 0
Kicked = 0
Banned = 0
Script
Код:
enum pInfo
{
    pPass,
    pAdmin,
    pScore,
    pCash,
    pKills,
    pDeaths,
    pReactionTests,
    pMoneyBags,
    pWarned,
    pKicked,
    pBanned
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
	INI_Int("Password",PlayerInfo[playerid][pPass]);
	INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	INI_Int("Score",PlayerInfo[playerid][pScore]);
	INI_Int("Cash",PlayerInfo[playerid][pCash]);
	INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("ReactionTests",PlayerInfo[playerid][pReactionTests]);
    INI_Int("MoneyBags",PlayerInfo[playerid][pMoneyBags]);
    INI_Int("Warned",PlayerInfo[playerid][pWarned]);
    INI_Int("Kicked",PlayerInfo[playerid][pKicked]);
    INI_Int("Banned",PlayerInfo[playerid][pBanned]);
 	return 1;
}

public OnPlayerConnect(playerid)
{
	if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit");
	}
	else
	{
 		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit"); //Line 522
	}

	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
	INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
	INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
	INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
	INI_WriteInt(File,"Password",PlayerInfo[playerid][pPass]);
	INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
	INI_WriteInt(File,"RectionTests",PlayerInfo[playerid][pReactionTests]);
	INI_WriteInt(File,"Moneybags",PlayerInfo[playerid][pMoneyBags]);
	INI_WriteInt(File,"Warned",PlayerInfo[playerid][pWarned]);
	INI_WriteInt(File,"Kicked",PlayerInfo[playerid][pKicked]);
	INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
	INI_Close(File);

	return 1;
}
Reply
#2

Paste the code that you use "PlayerInfo[playerid][pPass]" on. It'll probably be a register dialog.
Reply
#3

If you didn't notice, you are using DIALOG_REGISTER twice here:

pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit"); //Line 522
    }

    return 1;
}
So you need the login dialog in OnPlayerConnect.

Also, the order of loaduser_data isn't the same as in onplayerdisconnect.

So I will give you the correct OnPlayerDisconnect:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("RectionTests",PlayerInfo[playerid][pReactionTests]);
    INI_Int("Moneybags",PlayerInfo[playerid][pMoneyBags]);
    INI_Int("Warned",PlayerInfo[playerid][pWarned]);
    INI_Int("Kicked",PlayerInfo[playerid][pKicked]);
    INI_Int("Banned",PlayerInfo[playerid][pBanned]);
    INI_Close(File);
    return 1;
}

Reminder: You have 2 DIALOG_REGISTER dialogs in your OnPlayerConnect, put a DIALOG_LOGIN dialog in it..

If all this didn't work, give me your OnDialogResponse code.
Reply
#4

Quote:
Originally Posted by Youssef221
Посмотреть сообщение
If you didn't notice, you are using DIALOG_REGISTER twice here:

pawn Код:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit"); //Line 522
    }

    return 1;
}
So you need the login dialog in OnPlayerConnect.

Also, the order of loaduser_data isn't the same as in onplayerdisconnect.

So I will give you the correct OnPlayerDisconnect:

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("RectionTests",PlayerInfo[playerid][pReactionTests]);
    INI_Int("Moneybags",PlayerInfo[playerid][pMoneyBags]);
    INI_Int("Warned",PlayerInfo[playerid][pWarned]);
    INI_Int("Kicked",PlayerInfo[playerid][pKicked]);
    INI_Int("Banned",PlayerInfo[playerid][pBanned]);
    INI_Close(File);
    return 1;
}

Reminder: You have 2 DIALOG_REGISTER dialogs in your OnPlayerConnect, put a DIALOG_LOGIN dialog in it..

If all this didn't work, give me your OnDialogResponse code.
22 errors:
Код:
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(544) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(544) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(545) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(545) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(546) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(546) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(547) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(547) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(548) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(548) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(549) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(549) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(550) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(550) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(551) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(551) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(552) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(552) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(553) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(553) : error 017: undefined symbol "value"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(554) : error 017: undefined symbol "name"
C:\Users\Mohamed\Desktop\samp servering\gamemodes\grandlarc.pwn(554) : error 017: undefined symbol "value"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


22 Errors.
Script

Код:
public OnPlayerConnect(playerid)
{
	if(fexist(UserPath(playerid)))
	{
		INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
		ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FFFFFF}Logging in.......","{FFFFFF}This account is regsitered. Type your password below","Login","Quit");
	}
	else
	{
 		ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"{FFFFFF}Registering...","{FFFFFF}Type your password below to register a new account.","Register","Quit"); //Line 522
	}

	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	new INI:File = INI_Open(UserPath(playerid));
	INI_SetTag(File,"data");
	INI_Int("Password",PlayerInfo[playerid][pPass]);
	INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
	INI_Int("Score",PlayerInfo[playerid][pScore]);
	INI_Int("Cash",PlayerInfo[playerid][pCash]);
	INI_Int("Kills",PlayerInfo[playerid][pKills]);
	INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
	INI_Int("RectionTests",PlayerInfo[playerid][pReactionTests]);
	INI_Int("Moneybags",PlayerInfo[playerid][pMoneyBags]);
	INI_Int("Warned",PlayerInfo[playerid][pWarned]);
	INI_Int("Kicked",PlayerInfo[playerid][pKicked]);
	INI_Int("Banned",PlayerInfo[playerid][pBanned]);
	INI_Close(File);
	return 1;
}
Reply
#5

Show us those lines..
Reply
#6

You are loading the data when the player disconnects. That's wrong!
Reply
#7

http://imgur.com/AioPgbt
Reply
#8

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
You are loading the data when the player disconnects. That's wrong!
what should i do then ?
Reply
#9

The code that you posted in the beginning is correct. The question is, are you assigning a value to "PlayerInfo[playerid][pPass]" and "PlayerInfo[playerid][pAdmin]" somewhere in your script?

EDIT: the code that Youssef221 gave you is completely wrong.
Reply
#10

Well your "pPass" is set to be an integer (numbers only), you need to change it to a string so it can accept text. Also use "INI_WriteString" & "INI_String" to save and load the players password. Take a look at this tutorial if you need a bit more help.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)