SA-MP Forums Archive
Y_INI problem and Other - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Y_INI problem and Other (/showthread.php?tid=249219)



Y_INI problem and Other - nemesis_567 - 17.04.2011

One of my problems only happens on windows hosts. Some of my SetTimerEx fail to call the corresponding functions once in a while. There's nothing wrong with the code since it works on Linux Host but I need it to work as well on Windows hosts. I have quite a few SetTimerEx around the code, but I don't think there is a limit or anything that may cause such a thing. If you know what it can be please post here.

Ok, I have a problem with Y_INI, the files save correctly but they don't load. The script used to load them is posted bellow.
pawn Code:
// This is OnGameModeInit
~
        new factionfile[128];
        for(new i; i<MAX_FACTIONS;i++)
    {
            format(factionfile, sizeof (factionfile), "Factions/%d.INI", i);
        if(!fexist(factionfile)) SaveFaction();
                INI_ParseFile(factionfile, "LoadFaction", .bExtra = true, .extra = i, .bLocal=true);
    }

// This is somewhere on the script

forward LoadFaction(factionid, name[], value[]);
public LoadFaction(factionid, name[], value[])
{
    if(!strcmp(name,"Name")) strmid(FactionInfo[factionid][fName], value, 0, 32, 32);
    if(!strcmp(name,"Rank1")) strmid(FactionInfo[factionid][fRank1], value, 0, 15, 15);
    if(!strcmp(name,"Rank16"))strmid( FactionInfo[factionid][fRank16], value, 0, 15, 15);
    if(!strcmp(name,"Skin1")) FactionInfo[factionid][fSkin1]=strval(value);
    if(!strcmp(name,"InteriorX")) FactionInfo[factionid][fInteriorX]=floatstr(value);
    if(!strcmp(name,"InteriorY")) FactionInfo[factionid][fInteriorY]=floatstr(value);
    if(!strcmp(name,"InteriorZ")) FactionInfo[factionid][fInteriorZ]=floatstr(value);
    if(!strcmp(name,"ExteriorX")) FactionInfo[factionid][fExteriorX]=floatstr(value);
    if(!strcmp(name,"ExteriorY")) FactionInfo[factionid][fExteriorY]=floatstr(value);
    if(!strcmp(name,"ExteriorZ")) FactionInfo[factionid][fExteriorZ]=floatstr(value);
    if(!strcmp(name,"Interior")) FactionInfo[factionid][fInterior]=strval(value);
    if(!strcmp(name,"Locked")) FactionInfo[factionid][fLocked]=strval(value);
    return 1;
}
Thanks for reading,
James


Re: Y_INI problem and Other - nemesis_567 - 17.04.2011

Edited-


Re: Y_INI problem and Other - Andy6999 - 17.04.2011

If you had taken your time reading the big post litterally screaming "read this before posting" maybe I would of helped


Re: Y_INI problem and Other - nemesis_567 - 17.04.2011

If I had the time to wait for your answer I wouldn't have made the bump.


Re: Y_INI problem and Other - Stigg - 17.04.2011

Quote:
Originally Posted by Andy6999
View Post
If you had taken your time reading the big post litterally screaming "read this before posting" maybe I would of helped
Try and help rather than hinder with pointless comments.

Quote:
Originally Posted by nemesis_567
View Post
If I had the time to wait for your answer I wouldn't have made the bump.
Read the rules. You have to wait.

https://sampforum.blast.hk/showthread.php?tid=45235


Re: Y_INI problem and Other - Mean - 17.04.2011

I know this bug, you need to use ParseFile right after the format

But in this code, you can't do it right after the format. Find an other way.

Try, idk if it will work:
pawn Code:
for( new i; i < MAX_FACTIONS; i++ )
{
    new factionfile[ 128 ];
    format( factionfile, sizeof factionfile, "Factions/%d.INI", i );
    if( !fexist( factionfile ) ) SaveFaction( );
    INI_ParseFile( factionfile, "LoadFaction", .bExtra = true, .extra = i, .bLocal=true );
}



Re: Y_INI problem and Other - nemesis_567 - 17.04.2011

pawn Code:
for( new i; i < MAX_FACTIONS; i++ )
{
    new factionfile[ 128 ];
    format( factionfile, sizeof factionfile, "Factions/%d.INI", i );
    //if( !fexist( factionfile ) ) SaveFaction( );
    INI_ParseFile( factionfile, "LoadFaction", .bExtra = true, .extra = i, .bLocal=true );

}
You mean this?


Re: Y_INI problem and Other - Mean - 17.04.2011

Yes, you must do it right after the format, but then you can't save the faction.


Re: Y_INI problem and Other - nemesis_567 - 17.04.2011

What if I do:
pawn Code:
for( new i; i < MAX_FACTIONS; i++ )
{
    new factionfile[ 128 ];
    format( factionfile, sizeof factionfile, "Factions/%d.INI", i );
    if( !fexist( factionfile ) ) SaveFaction( );
    format( factionfile, sizeof factionfile, "Factions/%d.INI", i );
    INI_ParseFile( factionfile, "LoadFaction", .bExtra = true, .extra = i, .bLocal=true );

}
A bit redundant and inefficient but would it fix it?

And what about the SetTimerEx bugs, it's quite unusual, they seem to occur randomly which makes it even harder to identify. And as I said it worked ok in linux(Volt-Host) but now in KingJ with Windows I'm facing these problems(Which I've faced before in my homehost)

EDIT: Mean, that wasn't the problem, I did it right after the format and it didn't work as well.