y_ini doesn't parse files?
#1

Literally I feel stupidty, y_ini works prefectly in my gamemode, but it doesn't in my filterscript..
I trying to load/save an integer, it saves but, it doesn't even call the LoadUser stock..
Heres my codes.. I'm pretty sure theres no thing wrong in this code, Because I compared it with my gamemode ones its same..

LoadUser:
PHP код:
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Police",Police[playerid]);
    
INI_Int("JailTime",JailTime[playerid]);
    
SendClientMessageToAll(-1"User data loaded.");
    return 
1;

UserPath stock:
PHP код:
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),Path,playername);
    return 
string;

Path define:
PHP код:
#define Path "Police/%s.ini" 
OnPlayerConnect:
PHP код:
public OnPlayerConnect(playerid)
{    
    if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
SendClientMessageToAll(-1"File exists, Called LoadUser.");
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
    }
    else
    {
        new 
INI:File INI_Open(UserPath(playerid));
        
INI_SetTag(File,"police");
        
INI_WriteInt(File,"Police",0);
        
INI_WriteInt(File,"JailTime",0);
        
INI_Close(File);
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
SendClientMessageToAll(-1"File not exists, Created New file.");
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
    }
    return 
1;

OnPlayerDisconnect:
PHP код:
public OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"police");
    
INI_WriteInt(File,"Police",Police[playerid]);
    
INI_WriteInt(File,"JailTime",JailTime[playerid]);
    
INI_Close(File);
    
Police[playerid] = 0;
    
JailTime[playerid] = 0;
    
    return 
1;

I've added some debug strings as you can see, But it doesn't show
PHP код:
SendClientMessageToAll(-1"User data loaded."); 
In LoadUser stock, So I can say, The stock isn't being called even...
What causes this? I checked my codes many time, I'm pretty sure theres nothing wrong with it so.. Probably a bug in y_ini?
Reply
#2

Why do you parse it twice?
Make a debug line for each line and see what's wrong.
Reply
#3

I tried to parse it twice because it doesn't get parsed, I already tried the debug lines, but it doesn't even call the LoadUser..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)