Loading ranks
#1

Could anymore help me? When I save my factions, it saves the rank. but when loading it, it doesn't seem to load..

pawn Код:
SaveFactions(facid)
{
    new INI:File = INI_Open(FacPath(facid));
    INI_SetTag(File,"Faction");
    INI_WriteString(File,"Name", FacInfo[facid][fName]);
    INI_WriteFloat(File,"IntX", FacInfo[facid][IntX]);
    INI_WriteFloat(File,"IntY", FacInfo[facid][IntY]);
    INI_WriteFloat(File,"IntZ", FacInfo[facid][IntZ]);
    INI_WriteFloat(File,"ExtX", FacInfo[facid][ExtX]);
    INI_WriteFloat(File,"ExtY", FacInfo[facid][ExtY]);
    INI_WriteFloat(File,"ExtZ", FacInfo[facid][ExtZ]);
    INI_WriteInt(File,"Interior", FacInfo[facid][fInterior]);
    INI_WriteString(File,"Rank1", FacInfo[facid][fRank1]);
    INI_WriteString(File,"Rank2", FacInfo[facid][fRank2]);
    INI_WriteString(File,"Rank3", FacInfo[facid][fRank3]);
    INI_WriteString(File,"Rank4", FacInfo[facid][fRank4]);
    INI_WriteString(File,"Rank5", FacInfo[facid][fRank5]);
    INI_WriteString(File,"Rank6", FacInfo[facid][fRank6]);
    INI_WriteInt(File,"Type", FacInfo[facid][fType]);
    INI_WriteInt(File,"Vault", FacInfo[facid][fVault]);
    INI_WriteInt(File,"Materials", FacInfo[facid][fMaterials]);
    INI_WriteInt(File,"Weed", FacInfo[facid][fWeed]);
    INI_WriteInt(File,"Cocaine", FacInfo[facid][fCocaine]);
    INI_Close(File);
    return 1;
}
pawn Код:
forward LoadFactions_Faction(facid,name[],value[]);
public LoadFactions_Faction(facid,name[],value[])
{
    INI_String("Name", FacInfo[facid][fName], 35);
    INI_Float("IntX", FacInfo[facid][IntX]);
    INI_Float("IntY", FacInfo[facid][IntY]);
    INI_Float("IntZ", FacInfo[facid][IntZ]);
    INI_Float("ExtX", FacInfo[facid][ExtX]);
    INI_Float("ExtY", FacInfo[facid][ExtY]);
    INI_Float("ExtZ", FacInfo[facid][ExtZ]);
    INI_Int("Interior", FacInfo[facid][fInterior]);
    INI_String("Rank1", FacInfo[facid][fRank1], 24);
    INI_String("Rank2", FacInfo[facid][fRank2], 24);
    INI_String("Rank3", FacInfo[facid][fRank3], 24);
    INI_String("Rank4", FacInfo[facid][fRank4], 24);
    INI_String("Rank5", FacInfo[facid][fRank5], 24);
    INI_String("Rank6", FacInfo[facid][fRank6], 24);
    INI_Int("Type", FacInfo[facid][fType]);
    INI_Int("Vault", FacInfo[facid][fVault]);
    INI_Int("Materials", FacInfo[facid][fMaterials]);
    INI_Int("Weed", FacInfo[facid][fWeed]);
    INI_Int("Cocaine", FacInfo[facid][fCocaine]);
    return 1;
}
Reply
#2

where do you load the data? (INI_ParseFile)
Reply
#3

Sorry! forgot that part:
pawn Код:
LoadFactions(fac)
{
    new LoadString[30 + 8]; // Being Faction Name

    INI_ParseFile(FacPath(fac), "LoadFactions_%s", .bExtra = true, .extra = fac); // Here, it's laoding the faction variables!


    format(LoadString, sizeof(LoadString), ""COL_RED"[Faction]"COL_WHITE"\n%s", FacInfo[fac][fName]);

    FactionLabel[fac] = CreateDynamic3DTextLabel(LoadString, COLOR_YELLOW, FacInfo[fac][ExtX], FacInfo[fac][ExtY], FacInfo[fac][ExtZ], 20.0);
    FactionPickup[fac] = CreatePickup(1239, 1, FacInfo[fac][ExtX], FacInfo[fac][ExtY], FacInfo[fac][ExtZ], 0);
    return 1;
}
Reply
#4

Try this;
INI_ParseFile(FacPath(fac), "LoadFactions");
Also make sure, the first parameter is the file's directory of your faction.
Reply
#5

Nope, still don't work. No errors or warning, just don't load the faction rank
Reply
#6

Oh I forgot.
public LoadFactions(facid,name[],value[])
Once again, make sure the first parameter of ini_parsefile is the file's directory of your faction.
Reply
#7

I get errors using those saying "LoadFactions is already defined". I don't want to change anything, I just want to be able to load the ranks..

****** said(I believe), "Save as a string, load as an integar" - Would this affect anything?
Reply
#8

Quote:
Originally Posted by Zeppo
Посмотреть сообщение
I get errors using those saying "LoadFactions is already defined".
then name it to something else?
INI_ParseFile(FacPath(fac), "Load_Factions"
public/forward Load_Factions(.....);

Quote:
Originally Posted by Zeppo
Посмотреть сообщение
I don't want to change anything, I just want to be able to load the ranks..
pawn Код:
#define INSANITY "Doing the same thing over and over again and expecting different results"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)