Y_INI problem and Other
#1

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
Reply
#2

Edited-
Reply
#3

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

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

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
Reply
#6

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 );
}
Reply
#7

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?
Reply
#8

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)