Loading Factions
#1

pawn Код:
public SaveFactionsEx()
{
    new file[128];
    for(new factionid = 0; factionid < 100; factionid++)
    {
        format(file, sizeof(file), "/server/factions/%d.cfg", fInfo[factionid][fID]);
        if (!dini_Exists(file))
        {
            dini_Create(file);
            dini_IntSet(file,"fid",fInfo[factionid][fID]);
            dini_IntSet(file,"ftaken",fInfo[factionid][fTaken]);
            dini_Set(file,"fname",fInfo[factionid][fName]);
            dini_Set(file,"fleader",fInfo[factionid][fLeader]);
            dini_IntSet(file,"fmembers",fInfo[factionid][fMembers]);
        }
    }
    return 1;
}
pawn Код:
public LoadFactionEx()
{
    new file[128], string[256];
    for(new factionid = 0; factionid < 100; factionid++)
    {
        format(file, sizeof(file), "/server/factions/%d.cfg", fInfo[factionid][fID]);
        if (dini_Exists(file))
        {
            fInfo[factionid][fID] = dini_Int(file, "fid");
            fInfo[factionid][fTaken] = dini_Int(file, "ftaken");
            string = dini_Get(file, "fname");
            strmid(fInfo[factionid][fName], string, 0, strlen(string), 255);
            string = dini_Get(file, "fleader");
            strmid(fInfo[factionid][fLeader], string, 0, strlen(string), 255);
            fInfo[factionid][fMembers] = dini_Int(file, "fmembers");
           
            printf("Family: %d Taken: %d Name: %s Leader: %s Members: %d",
            fInfo[factionid][fID],
            fInfo[factionid][fTaken],
            fInfo[factionid][fName],
            fInfo[factionid][fLeader],
            fInfo[factionid][fMembers]);
        }
    }
    return 1;
}
The problem is is that it saves but it doesn't load. Help will be appreciated, thanks.
Reply
#2

Anyone who knows this?
Reply
#3

Shouldn't this:
Код:
 format(file, sizeof(file), "/server/factions/%d.cfg", fInfo[factionid][fID]);
be this: ?
Код:
 format(file, sizeof(file), "/server/factions/%d.cfg", factionid);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)