PDA

View Full Version : Do not load Y_INI value?


DevilAgain
13/03/2015, 03:41 PM
Hello, my problem is that I can not get the value that is contained in the personal player file, for example:

Password: 1234

I try to load it in the game with the code below, but is 0 the loaded value and the file is 1234. I did debug and printou 0 in the console and do not know what to do ..

// OnPlayerConnect:
if(fexist(_var))
INI_ParseFile(User(playerid),"Load_%s", .bExtra = true, .extra = playerid);

//Loading conta:
public Load_user(playerid, name[], value[]){

new INI:file = INI_Open(User(playerid));

INI_Int("Senha", Info[playerid][SenhaX]);

INI_Close(file);
return 1;
}

// Creating Conta
public Create(playerid){
new INI:file = INI_Open(User(playerid));
INI_WriteInt(file, "Senha", 0000);
INI_Close(file);

INI_ParseFile(User(playerid),"Load_%s", .bExtra = true, .extra = playerid);
return 1;
}

stock User(playerid)
{
new string[128], playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername, sizeof(playername));
format(string,sizeof(string), "Contas/%s.ini", playername);
return string;
}

ATGOggy
13/03/2015, 03:43 PM
Well, try this://Loading conta:
public Load_user(playerid, name[], value[]){

new INI:file = INI_Open(User(playerid));

INI_Int("Senha", Info[playerid][SenhaX]);
INI_SetTag(file, "data");
INI_Close(file);
return 1;
}

// Creating Conta
public Create(playerid){
new INI:file = INI_Open(User(playerid));
INI_SetTag(file, "data");
INI_WriteInt(file, "Senha", 0000);
INI_Close(file);

INI_ParseFile(User(playerid),"Load_%s", .bExtra = true, .extra = playerid);
return 1;
}

DevilAgain
13/03/2015, 09:34 PM
Not fuction.

Helps?

JuanStone
13/03/2015, 09:41 PM
what exactly is the problem ?

DevilAgain
13/03/2015, 09:48 PM
My problem is that I can't seem to get the value of an .ini file using Y_INI. Namely, I have on a player's .ini file as follows:

Password: 1234.

And I want to load it, but after doing so, I get the value 0 and the value 1234. The code above is the way I am doing ...

JuanStone
13/03/2015, 10:03 PM
When loading a file must not open it for writing, you must open it to read it, try as well.


// OnPlayerConnect:
if(fexist(User(playerid)))

public Load_user(playerid, name[], value[])
{
//new INI:file = INI_Open(User(playerid));

INI_Int("Senha", Info[playerid][SenhaX]);

//INI_Close(file);

return true;
}

DevilAgain
13/03/2015, 10:28 PM
No Sucess....

DevilAgain
14/03/2015, 05:52 PM
UPPpppp

DevilAgain
14/03/2015, 10:48 PM
help pleaseeeeeeeeee