stock CreateFaction(FName[])
{
for(new i = 1; i < MAX_FACTIONS; i++)
{
new Factionfile[256];
format(Factionfile, sizeof(Factionfile), "factions/Faction_%d.ini", i);
dini_Create(Factionfile);
dini_Set(Factionfile, "FactionName", FName);
dini_Set(Factionfile, "FactionRank1", "Default");
dini_Set(Factionfile, "FactionRank2", "Default");
dini_Set(Factionfile, "FactionRank3", "Default");
dini_Set(Factionfile, "FactionRank4", "Default");
dini_Set(Factionfile, "FactionRank5", "Default");
dini_Set(Factionfile, "FactionRank6", "Default");
dini_Set(Factionfile, "FactionRank7", "Default");
printf("[SYSTEM] Faction created: %s", FName);
}
return LoadFactions();
}
stock LoadFactions()
{
new Factionfile[256];
for(new i = 1; i < MAX_FACTIONS; i++)
{
format(Factionfile, sizeof(Factionfile), "factions/Faction_%d.ini", i);
if(fexist(Factionfile) )
{
format(Faction[i][FactionName], MAX_STRING, "%s",dini_Get(Factionfile, "FactionName" ));
format(Faction[i][FactionRank1], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank1" ));
format(Faction[i][FactionRank2], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank2" ));
format(Faction[i][FactionRank3], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank3" ));
format(Faction[i][FactionRank4], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank4" ));
format(Faction[i][FactionRank5], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank5" ));
format(Faction[i][FactionRank6], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank6" ));
format(Faction[i][FactionRank7], MAX_STRING, "%s",dini_Get(Factionfile, "FactionRank7" ));
printf( "[SYSTEM] Faction %d spawned.", i);
}
}
return 1;
}
enum fInfo2
{
topnumber,
}
new Factions[fInfo2];
new fid;
fid = Factions[topnumber]+1;
//Save Factions Info
forward SaveFactionsInfo();
public SaveFactionsInfo()
{
format(file, sizeof(file), "factions/Findex.ini");
if(fexist(file))
{
dini_IntSet(file, "topnumber", Factions[topnumber]);
}
return 1;
}
//Load Factions Info
forward LoadFactionsInfo();
public LoadFactionsInfo()
{
format(file, sizeof(file), "factions/Findex.ini");
if(fexist(file))
{
Factions[topnumber] = dini_Int(file, "topnumber");
}
return 1;
}
for(new i = 1; i < MAX_FACTIONS; i++)
Are you sure I have to do all this? I thought It was something to do with
pawn Код:
|