SA-MP Forums Archive
Do not load Y_INI value? - 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)
+--- Thread: Do not load Y_INI value? (/showthread.php?tid=567381)



Do not load Y_INI value? - DevilAgain - 13.03.2015

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

PHP код:
// OnPlayerConnect: 
    
if(fexist(_var)) 
        
INI_ParseFile(User(playerid),"Load_%s", .bExtra true, .extra playerid); 
//Loading conta: 
public Load_user(playeridname[], 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,playernamesizeof(playername)); 
    
format(string,sizeof(string), "Contas/%s.ini"playername); 
    return 
string




Re: Do not load Y_INI value? - ATGOggy - 13.03.2015

Well, try this:
PHP код:
//Loading conta:  
public Load_user(playeridname[], 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;  




Re: Do not load Y_INI value? - DevilAgain - 13.03.2015

Not fuction.

Helps?


Respuesta: Do not load Y_INI value? - JuanStone - 13.03.2015

what exactly is the problem ?


Re: Do not load Y_INI value? - DevilAgain - 13.03.2015

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


Respuesta: Do not load Y_INI value? - JuanStone - 13.03.2015

When loading a file must not open it for writing, you must open it to read it, try as well.

PHP код:
// OnPlayerConnect:
    
if(fexist(User(playerid))) 
PHP код:
public Load_user(playeridname[], value[])
{
    
//new INI:file = INI_Open(User(playerid));
    
    
INI_Int("Senha"Info[playerid][SenhaX]);
    
    
//INI_Close(file);
    
    
return true;




Re: Do not load Y_INI value? - DevilAgain - 13.03.2015

No Sucess....


Re: Do not load Y_INI value? - DevilAgain - 14.03.2015

UPPpppp


Re: Do not load Y_INI value? - DevilAgain - 14.03.2015

help pleaseeeeeeeeee