enum formatting help.. -
2KY - 15.02.2012
dsaasdd
Re: enum formatting help.. -
[NSN]iRc - 15.02.2012
Figure out the problem yourself and, know the answer, you will.
Re: enum formatting help.. -
Psymetrix - 15.02.2012
I'm not the best at explaining the stuff but..
pawn Code:
#define MAX_FACTIONS 10
enum E_FACTION_INFO {
E_FACTION_NAME[64],
//...
}
new facInfo[MAX_FACTIONS][E_FACTION_INFO];
If you setup your enum and variable like that..
format(facInfo[%s], 64, facStr); would be come
format(facInfo[GetPVarInt(playerid, "FactionEdit")][E_FACTION_NAME], 64, facStr);
What I'm trying to say is, you have set up your variable wrong.
Re: enum formatting help.. - T0pAz - 15.02.2012
Enumerators should not be used like that. See
this tutorial for more info.
Re: enum formatting help.. -
2KY - 15.02.2012
Alright, I took a read, and i've run into one problem, although I'm not sure if it's an enum problem anymore.. I think the problem is with INI_ParseFile, which I'm assuming I'm not using it correctly. Help? Please?
pawn Code:
#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;
}
What am I doing wrong? I'm so close, yet so far.