15.02.2012, 02:47
(
Last edited by 2KY; 15/02/2012 at 08:17 PM.
)
dsaasdd
#define MAX_FACTIONS 10
enum E_FACTION_INFO {
E_FACTION_NAME[64],
//...
}
new facInfo[MAX_FACTIONS][E_FACTION_INFO];
#define MAX_FACTIONS 100
enum E_facVars
{
facName[64],
facType,
facRank1[32],
facRank2[32],
facRank3[32],
facRank4[32],
facRank5[32]
}
new
facInfo[MAX_FACTIONS][E_facVars];
public OnGameModeInit()
{
new
facStr[32];
for( new f = 0; f < MAX_FACTIONS; f++ )
{
format(facStr, sizeof(facStr), "RPMod/Factions/%d.ini", f);
if(fexist(facStr))
{
INI_ParseFile(facStr, "LoadFaction");
printf("[LOAD] Faction %d loaded; Name: %s | Type: %d", f, facInfo[f][facName], facInfo[f][facType]);
}
}
return true;
}
public OnGameModeExit()
{
new
facStr[15];
for( new f = 0; f < MAX_FACTIONS; f++ )
{
format(facStr, sizeof(facStr), "RPMod/Factions/%d.ini", f);
if(fexist(facStr))
{
new
INI:facFile = INI_Open(facStr);
INI_WriteString(facFile, "Name", facInfo[f][facName]);
INI_WriteInt(facFile, "Type", facInfo[f][facType]);
INI_WriteString(facFile, "Rank1", facInfo[f][facRank1]);
INI_WriteString(facFile, "Rank2", facInfo[f][facRank2]);
INI_WriteString(facFile, "Rank3", facInfo[f][facRank3]);
INI_WriteString(facFile, "Rank4", facInfo[f][facRank4]);
INI_WriteString(facFile, "Rank5", facInfo[f][facRank5]);
INI_Close(facFile);
}
}
return true;
}
forward LoadFactions(name[], value[]);
public LoadFactions(name[], value[])
{
for ( new f = 0; f < MAX_FACTIONS; f++ )
{
INI_String("Name", facInfo[f][facName], 64);
INI_Int("Type", facInfo[f][facType]);
INI_String("Rank1", facInfo[f][facRank1], 32);
INI_String("Rank2", facInfo[f][facRank2], 32);
INI_String("Rank3", facInfo[f][facRank3], 32);
INI_String("Rank4", facInfo[f][facRank4], 32);
INI_String("Rank5", facInfo[f][facRank5], 32);
}
return true;
}